// interface for a priority queue - implementor needs a getPriority method. public interface Prioritizable { public int getPriority(); } // Class of objects to be stored in priority queue. public class MyData implements Prioritizable { private int priority; private String name; private double salary; public MyData() { } public MyData(int p, String n, double sa) { } public int getPriority() { return priority; } public String toString() { } } import java.util.*; public class PriorityQueue extends Vector { public void insert (Object o) { Queue qNew; // check for empty priority queue if (empty()) { } // non-empty priority queue for (int i = 0; i < size(); i++) { // Get queue at element i and its priority Queue temp = (Queue) elementAt(i); int prior = ((Prioritizable) temp.peek()).getPriority(); // insert in queue temp or in another queue based on priority if (((Prioritizable) o).getPriority() == prior) { // Queue exists with given priority - insert o in it. } else if (((Prioritizable) o).getPriority() > prior) { // No queue with this priority - create a new one - // insert o in it. } } // end for // Add a new queue to end of priority queue - insert o in it } public boolean empty() { } public Object peek() { } public Object remove() { } } import myIO.*; public class PQOperations { // storage for a priority queue. private PriorityQueue pQ = new PriorityQueue(); public PQOperations() { } public MyData readMyData() { } public void doPqOps() { MyData mD; boolean done = false; while (!done) { String choices[] = {"insert", "peek", "remove", "quit"}; int choice = IO.getChoice("Choose an operation", choices); switch (choice) { case 0: { } case 1: { } case 2: { } case 3: { } } IO.displayResult(pQ.toString()); } } }