Question: This is to be done using Java TreeMap in Textpad. The task is to write a program that will organize a list of Bowlers into
This is to be done using Java TreeMap in Textpad.
The task is to write a program that will organize a list of Bowlers into a TreeMap. The TreeMap should have scores as the keys with a PriorityQueue of Bowlers as the values. The overall effect will be to have a list of scores from lowest to highest associated with a list of bowlers who achieved that score.
The Bowler class should store First Name, Last Name, and Score with the following priority: 1. Last Name (in ascending order). 2. First Name (in ascending order). (There is no need to include the score in the priority list because it will be used as a key)
You need to grab the queues from the Map but walk through the queues in the way that queues need to be walked through. PriorityQueues do not display in order unless you walk through them with peek() and poll(). You cant just display a priority queue with a System.out.print() statement and expect the queue to be sorted properly.
The BOWLER DATA IS GIVEN BELOW (this can be put in a text file that is read in TextPad):
Ronnie Roller 212 Ricky Rolly 184 Robbie Rollman 165 Rosie Bowlman 234 Rubie Bowler 197 Roddy Bowly 203 Richard Rollo 114 Roberto Rollover 158 Reinhold Gutterball 224 Raymond Gutterman 147 Roger Striker 210 Rodney Spare 165 Rupert Splitter 234 Regan Splitsman 188 Ronetta Gutter 197 Roberta Rollerball 155 Rishi Alley 158 Richie Alleyman 164 J.K. Bowling 190 Rudy Roley 165 Rosita Bowly 212 Reynaldo Rollberto 114 Roland Framer 234 Roman Frameman 165 Rutherford Openframe 114 Roanoke Spinster 147 Raj Spinmeister 165 Ravi Bowlingshoe 234 Rafael Rollyshoe 158 Ralphie Splitsville 231 Roald Strikedon 114 Reggie Spareman 165 Reginald Rolltater 203 Rhoda Backend 212 Rhonda Bender 190 Roy Turkey 212 Rock Flyingelbow 258 RayRay Release 155 Ruben Sixpack 147 Robinho Hook 212
Example Output Format (Note: This is just the beginning of the actual output): 114=[Rutherford Openframe, Richard Rollo, Reynaldo Rollberto, Roald Strikedon] 147=[Raymond Gutterman, Roanoke Spinster, Ruben Sixpack] 155=[RayRay Release, Roberta Rollerball]
...
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
