// This program hires and fires teaching assistants based on their experience. // A PriorityQueue is used to order the TAs based on experience. import java.io.*; import java.util.*; public class TAManager { public static void main(String[] args) throws IOException { Queue tas = new PriorityQueue(); // read all current TAs from a file "tas.txt" Scanner in = new Scanner(new File("tas.txt")); while (in.hasNext()) { String name = in.next(); int exp = in.nextInt(); TA ta = new TA(name, exp); tas.add(ta); } // tas with <= 2 quarters of experience are fired System.out.println(tas); int fired = 0; while (tas.peek().getExperience() <= 2) { tas.remove(); fired++; } System.out.println("fired " + fired + " TAs."); System.out.println(tas); } }