Question: This program will store the roster and rating information for a soccer team. There will be 3 pieces of information about each player: Name: string,
This program will store the roster and rating information for a soccer team. There will be 3 pieces of information about each player:
Name: string, 1-100 characters (nickname or first name only) Jersey Number: integer, 1-99 (these must be unique) Rating: double, 0.0-100.0
You must use 3 arrays to store this information. You should initialize each array with appropriate values. There will be no more than 10 players on each team.
You will implement a menu of options for the user to build and modify the roster. Each option is represented by a single character. The program initially outputs the menu, prompts the user for a choice and then processes that choice (HINT: this is a good place to use a switch statement.) The menu is provided as part of the start code and looks like this:
MENU a - Add a new player u - Update player information r - Remove a player from the roster d - Display player information p - Print the full roster s - Print "Star" players q - Quit
Please make a selection:
Each option should operate as follows: -------------------------------------------------------------------------------------------
a - Add a new player, prompts the user as follows Enter player jersey number: Enter player first or nick name: Enter player rating:
NOTE: lookup the player info by jersey number... if found...display an error message and return to the menu if not found...enter the data as above
NOTE: If the maximum number of players has been entered... display an error message and return to the menu
NOTE: You do not need to validate the range of the rating.
(HINT: entering the player name can be done with a scanf)
-------------------------------------------------------------------------------------------
u - Update player information Enter player jersey number:
NOTE: lookup the player info by jersey number... if found...prompt for name and rating as in option 'a' if not found...display an error message and return to the menu
NOTE: You do not need to validate the range of the rating.
-------------------------------------------------------------------------------------------
r - Remove a player from the roster Enter player jersey number:
NOTE: lookup the player info by jersey number... if found...remove the player if not found...display an error message and return to the menu
-------------------------------------------------------------------------------------------
d - Display player information Enter player jersey number:
Display the following: Name: Jersey #: Rating:
NOTE: lookup the player info by jersey number... if found...display the information if not found...display an error message and return to the menu
-------------------------------------------------------------------------------------------
p - Print the full roster Prints all the information for all the players:
ROSTER ------- Player Name 1 Player Jersey # Player Rating
Player Name 2 Player Jersey # Player Rating
... for as many players as have been entered ...
-------------------------------------------------------------------------------------------
s - Print "STAR" players Prints all the players with a rating greater than the star rating Prompt the user as follows:
Enter "STAR" rating:
MY STARS -------- Player Name 1 Player Jersey # Player Rating
Player Name 2 Player Jersey # Player Rating
... for as many players as meet the criteria... and there may be none!
-------------------------------------------------------------------------------------------
q - Quit Normal exit for the program
-------------------------------------------------------------------------------------------
Your program will need to implement the following function: int findPlayer(int whichPlayer, const int jerseyNumbers[], int maxJersyCount);
This function takes a player jersey 3 (whichPlay) and looks for that value in the jerseyNumber array.
If found...return the index number if NOT found...return a -1
You will need this function!
-------------------------------------------------------------------------------------------
HINT: There are 2 ways to approach this project and the arrays. - Keep a player count and then move data when removing players. - Use an illegal jersey # when removing players (this is the easier approach)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
