Problem Description and Given Info
The volleyball coach at Verde Valley High School would like somehelp managing her team. She would like a program to help heridentify the best players. She has team rosters stored in textfiles that contain the names of her players (first name, then lastname separated by a space), and their stats as attacks per set (adouble) followed by blocks per set (a double). Higher stat scoresare better. Each data field is separated by a space. For example,one line in a roster file would look like:
The coach would like the program to do the following:
Present a menu with the following options:
When the user chooses 1 to open aroster file, then the program will ask for the filename of a rosterfile, then open and read the data from that file intoan ArrayList.
When the user chooses 2 to list allplayers, then the program will list the names and stats of allplayer players.
When the user chooses 3 to list topattackers, then the program will determine and list the names andstats of the players with the top 2 attack stats.
When the user chooses 4 to list topblockers, then the program will determine and list the names andstats of the players with the top 2 stats for blocks.
When the user chooses 5 to add aplayer, then the program will prompt the user to enter the newplayer's name (first and last), attack stat (double), and blockstat (double). The program should collect this information from theuser, and then instantiate a new Player object with the given nameand stats, and add that Player to the roster.
When the user chooses 6 to change aplayer's stats, then the program will prompt the user to enter theplayer's name (first and last). If there is a player on the rosterwith the given name, then the program will collect the new attackstat score (double), and block stat score (double), and will updatethe stat values for this player.
When the user chooses 7 to countplayers, then the program will display the number of players on thecurrent roster.
When the user chooses 8 the programwill end.
The Main class has already been designed and writtenfor this program. Carefully review the code inthe Main.java file and be sure that youunderstand how it works.
Your task is to implementthe Player and Roster classes.The Player class will allow us toinstantiate Player objects that will store the importantinformation (name, attack stat, block stat) for a player.The Roster class will allow us to create and manage aroster of players - we will usean ArrayList<Player> to storethe Player objects.
Part 1 - Implementthe Player Class
In a file named Player.java, implement theclass described below.
The Player class must have thefollowing private instance variables:
The Player class must have thefollowing public constructor method:
The Player class must have thefollowing public methods:
Other Details
Part 2 - Implementthe Roster Class
In a file named Roster.java, implement theclass described below.
The Roster class must have thefollowing private instance variables:
The Roster class must have thefollowing public constructor methods:
The Roster class must have thefollowing public methods:
Other Details
IN JAVA PLEASE and leave the code in a format that can becopied. THANK YOU
Problem Description and Given Info The volleyball coach at Verde Valley High School would like some help managing her te
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am