From 856c35dbc7080922bfff7c10a7a844a9d0a1cd65 Mon Sep 17 00:00:00 2001 From: mo Date: Sat, 25 May 2019 15:27:51 -0600 Subject: start assignment 2 --- src/Q8/Communication.java | 76 ----------------------------------------------- 1 file changed, 76 deletions(-) delete mode 100644 src/Q8/Communication.java (limited to 'src/Q8/Communication.java') diff --git a/src/Q8/Communication.java b/src/Q8/Communication.java deleted file mode 100644 index cc217e3..0000000 --- a/src/Q8/Communication.java +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Assignment 1, COMP268 Class: Communication.java - * - * @description Represents a candidates communication ability. - * @author: mo khan Student ID: 3431709 - * @date May 8, 2019 - * @version 1.0 - */ -package Q8; - -public class Communication implements Comparable { - private String name; - private Integer ranking; - - /** - * Constructs a Communication object. - * - * @param name the name of the communication level - * @param ranking the ranking of the communication level. - */ - public Communication(String name, Integer ranking) { - this.name = name; - this.ranking = ranking; - } - - /** - * Compares one communication level with another. - * - * @param other the other communication level to compare against - * @return a negative integer, zero, or a positive integer as this object is less than, equal to, - * or greater than the specified object. - */ - public int compareTo(Communication other) { - return this.ranking.compareTo(other.ranking); - } - - /** - * Compares one communication level with another. - * - * @param other the other communication level to compare against - * @return true if this communication level is equal to or better than the other. - */ - public boolean isAtLeast(Communication other) { - return this.compareTo(other) >= 0; - } - - /** - * The string representation of the candidate. - * - * @return the name of the candidate - */ - @Override - public String toString() { - return this.name; - } - - public static final Communication Poor = new Communication("poor", 0); - public static final Communication Average = new Communication("average", 1); - public static final Communication Excellent = new Communication("excellent", 2); - - /** - * @param name of the communication level to find. - * @return the Communication level matching the name - */ - public static Communication findBy(String name) { - switch (name) { - case "poor": - return Communication.Poor; - case "average": - return Communication.Average; - case "excellent": - return Communication.Excellent; - } - throw new IllegalArgumentException("Unknown communication type"); - } -} -- cgit v1.2.3