Starting from:

$15

program that records high-score data for a fictitious game.

Write a program that records high-score data for a fictitious game. The program will ask the user to enter five names, and five scores. It will store the data in memory, and print it back out sorted by score.The output from your program should look approximately like this:Enter the name for score #1: SuzyEnter the score for score #1: 600Enter the name for score #2: KimEnter the score for score #2: 9900Enter the name for score #3: BobEnter the score for score #3: 1012Enter the name for score #4: ArmandoEnter the score for score #4: 8000Enter the name for score #5: TimEnter the score for score #5: 514Top Scorers:Kim: 9900Armando: 8000Bob: 1012Suzy: 600Tim: 514RequirementsThe data must be stored in two ArrayLists: one ArrayList of strings named names, and one ArrayList of Integers named scores. These ArrayLists must be declared in the main method.All of the user input should be done in a method named InitializeArrays. It should have the following signature:public static void InitializeArrays(ArrayList names, ArrayList scores)You should write a function that sorts both array lists, based on the values in the scores array list. This is one of the more conceptually challenging parts of the assignment. You want to sort the scores array list, and simultaneously alter the names array list so that the names continue to line up with their respective scores by index. In the example data above, when the score 9900 moves to the first element of the scores array list, the name “Kim” should also be moved to the top of the names array list. The function should have the following signature:public static void sort(ArrayList names, ArrayList scores)Finally you should write a method that displays the contents of the two array lists. It should have the following signature:public static void display(ArrayList names, ArrayList scores)The main method should be very short. It should just declare and initialize the two array lists and then invoke these three methods.

More products