Description
This assignment will give you practice with classes, methods, and arrays.
Part 1: Player Class (10 points)
Write a class named Player that stores a player’s name and the player’s high score.
A player is described by:
player’s name
player’s high score
In your class, include:
instance data variables
two constructors
getters and setters
include appropriate value checks when applicable
a toString method
Part 2: PlayersList Class (10 points)
Write a class that manages a list of up to 10 players and their high scores. Create a single array of type
Player that stores the players’ names and scores.
In your class, include:
a single array of type Player to hold player name and score.
a constructor
Your class should support the following features:
Add a new player and score (up to 10 players).
method header: public void addPlayer()
Print all the players’ names and their scores to the screen.
method header: public void printPlayers()
Allow the user to enter a player’s name and output that player’s score or a message if that
player’s name has not been entered.
method header: public void lookupPlayer()
Notes
You can include additional instance data variables if it is helpful. If you include additional
variables, include additional getters and setters as appropriate.
I have provided a driver program ScoreManagementSystem.java you can use to test your code
and sample output.
_________________________________________________________________________________________________________
Page 2 of 3
Score Management System
Choose:
A)dd new player
P)rint all players
L)ookup a player’s score
Q)uit
A
Enter name:
Alexander
Enter score:
300
Score Management System
Choose:
A)dd new player
P)rint all players
L)ookup a player’s score
Q)uit
A
Enter name:
Michael
Enter score:
200
Score Management System
Choose:
A)dd new player
P)rint all players
L)ookup a player’s score
Q)uit
P
Score Name
300 Alexander
200 Michael
Score Management System
Choose:
A)dd new player
P)rint all players
L)ookup a player’s score
Q)uit
L
Enter name to look up.
George
Name not found.
_________________________________________________________________________________________________________
Page 3 of 3
Score Management System
Choose:
A)dd new player
P)rint all players
L)ookup a player’s score
Q)uit
P
Score Name
300 Alexander
200 Michael
Score Management System
Choose:
A)dd new player
P)rint all players
L)ookup a player’s score
Q)uit
L
Enter name to look up.
Michael
Michael’s score = 200
Score Management System
Choose:
A)dd new player
P)rint all players
L)ookup a player’s score
Q)uit
Q
Submission Instructions
Execute the program and copy/paste the output that is produced by your program into the bottom
of the source code file, making it into a comment. I will run the programs myself to see the
output.
Make sure the run “matches” your source. If the run you submit could not have come from the
source you submit, it will be graded as if you did not hand in a run.
Use the Assignment Submission link to submit the source code file.
Submit the following files:
o Player.java
o PlayersList.java
o ScoreManagementSystem.java