summaryrefslogtreecommitdiff
path: root/src/Q8/Communication.java
diff options
context:
space:
mode:
authormo <mo.khan@gmail.com>2019-05-25 15:27:51 -0600
committermo <mo.khan@gmail.com>2019-05-25 15:27:51 -0600
commit856c35dbc7080922bfff7c10a7a844a9d0a1cd65 (patch)
tree739b413bc2a29adc35229ef2fd9b30581601a206 /src/Q8/Communication.java
parent46f68298527e0c59b9f34003b687259477093fde (diff)
start assignment 2
Diffstat (limited to 'src/Q8/Communication.java')
-rw-r--r--src/Q8/Communication.java76
1 files changed, 0 insertions, 76 deletions
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<Communication> {
- 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");
- }
-}