// A TeachingAssistant object represents a teaching assistant. public class TeachingAssistant implements Comparable { private String name; private int experience; // quarters worked // Creates a teaching assistant with the given name and quarters of // experience // Throws IllegalArgumentException if name is null or experience is negative public TeachingAssistant(String name, int experience) { if (name == null || experience < 0) { throw new IllegalArgumentException(); } this.name = name; this.experience = experience; } // Returns quarters of experience. public int getExperience() { return experience; } // Returns a string containing the TA's name and quarters of experience. public String toString() { return name + " (" + experience + ")"; } public int compareTo(TeachingAssistant other) { if(experience != other.experience) { return experience - other.experience; } else { return name.compareTo(other.name); } } }