Assignment 5

Write a system that tracks the top five scores for a game. The system has a list of five items, and each item has a name and the corresponding score. Initially, the list consists of five items with the name Anonymous and the score of 0. The system supports four commands: add, rev, show, exit.

A complete example is given below (illustration).

Enter commands (add, rev, show, exit):

add 50 Potter

add 20 Ron

add 45 Granger

show

The top five scores are:

   1.       Potter, Score: 50

   2.      Granger, Score: 45

   3.          Ron, Score: 20

   4.    Anonymous, Score: 0

   5.    Anonymous, Score: 0

add 30 Malfoy

show

The top five scores are:

   1.       Potter, Score: 50

   2.      Granger, Score: 45

   3.       Malfoy, Score: 30

   4.          Ron, Score: 20

   5.    Anonymous, Score: 0

rev

show

The top five scores are:

   1.          Ron, Score: 50

   2.       Malfoy, Score: 45

   3.      Granger, Score: 30

   4.       Potter, Score: 20

   5.    Anonymous, Score: 0

exit