Question: Part-II: Write a Java application (a test class), PersonTest, to Define three priority queues: the first one with the natural ordering defined above; the


Part-II: Write a Java application (a test class), PersonTest, to Define three priority queues: the first one with the natural ordering defined above; the second one with the order of firstName-lastName-age; and the third one with the order of age-lastName-firstName. The second and third priority queues must use at least one of the following Java API Priority Queue (JCF's) constructors: PriorityQueue (Comparator Display the contents of the queues by removing the items one by one from the priority queues. Your output should be the same as the sample output shown below. The following gives the contents of the input file for testing your program: Elvis Goodyear 69 Steven Clark 8 Jane Graff 16 Nancy Goodyear 69 John Smith 72 Benjamin Smith 25 John Smith 25 Sample Output: Sorted by lastname, then firstname, and finally age: Clark, Steven: 8 years old. Goodyear, Elvis: 69 years old. Goodyear, Nancy: 69 years old. Graff, Jane: 16 years old. Smith, Benjamin: 25 years old. Smith, John: 25 years old. Smith, John: 72 years old. Sorted by firstname, then lastname, and finally age: Smith, Benjamin: 25 years old. Goodyear, Elvis: 69 years old. Graff, Jane: 16 years old. Smith, John: 25 years old. Smith, John: 72 years old. Goodyear, Nancy: 69 years old. Clark, Steven: 8 years old. Sorted by age, then lastname, and finally firstname: Clark, Steven: 8 years old. Graff, Jane: 16 years old. Smith, Benjamin: 25 years old. Smith, John: 25 years old. Goodyear, Elvis: 69 years old. Goodyear, Nancy: 69 years old. Smith, John: 72 years old.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
