Question: In C #include This program will store the roster and rating information for a soccer team. There will be 3 pieces of information about each

In C

#include

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!

starter code...

int findPlayer(int whichPlayer, const int jerseyNumbers[], int maxJersyCount);

int main(void) { char menuOp = 'x';

while (menuOp != 'q') { // Menu printf(" MENU "); printf("a - Add a new player "); printf("u - Update player information "); printf("r - Remove a player from the roster "); printf("d - Display player information "); printf("p - Print the full roster "); printf("s - Print \"Star\" players "); printf("q - Quit ");

printf(" Choose an option: ") ; scanf(" %c", &menuOp);

switch (menuOp) { case 'a': // your code goes here! case 'u': // your code goes here! case 'r': // your code goes here! case 'd': // your code goes here! case 'p': // your code goes here! case 's': // your code goes here! case 'q': // your code goes here! default: // your code goes here! }

return 0; }

int findPlayer(int whichPlayer, const int jerseyNumbers[], int maxJersyCount) { // your code goes here... }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!