// CSE 143, Summer 2012 // A TA object represents one teaching assistant. public class TA implements Comparable { private String name; private int experience; // # of quarters served as a TA public int compareTo(TA other) { if (this.experience != other.experience) { return this.experience - other.experience; } else { return this.name.compareTo(other.name); } } // Constructs a new TA with given name and number of quarters' experience. // Throws IllegalArgumentException if name is null or experience is negative. public TA(String name, int experience) { if (name == null || experience < 0) { throw new IllegalArgumentException(); } this.name = name; this.experience = experience; } // Returns the TA's name. public String getName() { return name; } // Returns the TA's quarters of experience. public int getExperience() { return experience; } // Returns string with name and number of quarters, such as "Kim (5q)". public String toString() { return name + " (" + experience + "q)"; } }