This program will store roster and rating information for a soccer team. Coaches rate players during tryouts to ensure a balanced team.(1) Prompt the user to input five pairs of numbers: A player's jersey number (0 - 99) and the player's rating (1 - 9). Store the jersey numbers and the ratings in a dictionary. Output the dictionary's elements with the jersey numbers in ascending order (i.e., output the roster from smallest to largest jersey number). Hint: Dictionary keys can be stored in a sorted list. (3 pts)Ex:Enter player 1's jersey number: 84Enter player 1's rating: 7Enter player 2's jersey number: 23Enter player 2's rating: 4Enter player 3's jersey number: 4Enter player 3's rating: 5Enter player 4's jersey number: 30Enter player 4's rating: 2Enter player 5's jersey number: 66Enter player 5's rating: 9ROSTERJersey number: 4, Rating: 5Jersey number: 23, Rating: 4Jersey number 30, Rating: 2...(2) Implement a menu of options for a user to modify the roster. Each option is represented by a single character. The program initially outputs the menu, and outputs the menu after a user chooses an option. The program ends when the user chooses the option to Quit. For this step, the other options do nothing. (2 pts)Ex:MENUa - Add playerd - Remove playeru - Update player ratingr - Output players above a ratingo - Output rosterq - QuitChoose an option: (3) Implement the "Output roster" menu option. (1 pt)Ex:ROSTERJersey number: 4, Rating: 5Jersey number: 23, Rating: 4Jersey number 30, Rating: 2...(4) Implement the "Add player" menu option. Prompt the user for a new player's jersey number and rating. Append the values to the two vectors. (1 pt)Ex:Enter a new player's jersey number: 49Enter the player's rating: 8(5) Implement the "Delete player" menu option. Prompt the user for a player's jersey number. Remove the player from the roster (delete the jersey number and rating). (1 pt)Ex:Enter a jersey number: 4(6) Implement the "Update player rating" menu option. Prompt the user for a player's jersey number. Prompt again for a new rating for the player, and then change that player's rating. (1 pt)Ex:Enter a jersey number: 23Enter a new rating for player: 6(7) Implement the "Output players above a rating" menu option. Prompt the user for a rating. Print the jersey number and rating for all players with ratings above the entered value. (2 pts)Ex:Enter a rating: 5ABOVE 5Jersey number: 66, Rating: 9Jersey number: 84, Rating: 7...

Respuesta :

Answer:

#include<stdio.h>

//function declaration

int search(int jersey[],int n);

void display(int jersey[],int rating[],int n);

int main()

{

char choice = ' ';

int jersey[5];

int rating[5];

int j=0,r=0,index;

for(int i=0;i<5;i++)

{

printf("Enter player's %d jersey number: \n",i+1);

scanf("%d",&j);

jersey[i] = j;

printf("Enter player's %d rating: \n",i+1);

scanf("%d",&r);

rating[i] = r;

}

while(choice != 'q')

{

printf("u- Update player rating\n");

printf("a- Output player above rating\n");

printf("r- Replace\n");

printf("o- Output roaster\n");

printf("q- Quit\n");

printf("Enter your choice(u,a,r,o,q): ");

scanf(" %c",&choice);

switch(choice)

{

case 'u':

printf("Enter jersey number: ");

scanf("%d",&j);

printf("Enter a new rating for a player: ");

scanf("%d",&r);

index = search(jersey,j);

rating[index] = r;

break;

case 'a':

printf("Enter a rating: ");

scanf("%d",&r);

display(jersey,rating,r);

break;

case 'r':

printf("Enter jersey number: ");

scanf("%d",&j);

index = search(jersey,j);

printf("Enter a new jersey number: ");

scanf("%d",&j);

jersey[index] = j;

printf("Enter a rating of new player: ");

scanf("%d",&r);

rating[index] = r;

break;

case 'o':

for(int i=0;i<5;i++)

{

printf("Player %d -- Jersey number: %d, Rating: %d\n",i+1,jersey[i],rating[i]);

}

break;

case 'q':

break;

default:

printf("You have enter wrong choice\n");

break;

}

}

}

int search(int jersey[],int n)

{

int i;

for(i=0;i<5;i++)

{

if(jersey[i] == n)

break;

}

return i;

}

void display(int jersey[],int rating[],int n)

{

for(int i=0;i<5;i++)

{

if(rating[i] >= n)

{

printf("Player %d -- Jersey number: %d, Rating: %d\n",i+1,jersey[i],rating[i]);

}

}

}

Explanation: