Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Formatting has to look exactly like the output shows on zybooks. Question is fro

ID: 3738257 • Letter: F

Question

Formatting has to look exactly like the output shows on zybooks.

Question is from - 5.17 Ch. 5 Program: Soccer team roster (C) in zyBooks C Programming.

5.17 Ch. 5 Program: Soccer team roster (C) Th S prog.?m w ll 5tore roster and ret ng informs: on fora soccer teem Coac nes r197e players dung tryouts to ensure b5 enced teem 1) Promp: the user to rput five pairs of numbers. Aplayesjersey number (0-99 end the players fating (1-9.Stone thejersey numbers n one rt amay and the ratings r another im ers;. OutDJ: ?ese arrays/ Le, output the "oster). ($ pts) Enzer plyer 1's Jersey murber: Enzer player Jersey nurber: Enzer player 3' Jersey nurber: Enzer playe 3' rating: Enzer piyer 5 jersey murber: Enzer player 4'a rating Enzer Tl yer'5 Jersey munber: Enzer playe ' rating Flager 1-Jerses nurber: 8, Rarig: laser Jeroey nuber: 2. aring: 2) Implementamenu of options for a user to mod tythe noaer Each apron s represenned byasrgle characzer The pogram initialy outouts the menu. and cutputs the menu after a user chooses an oprion. The progam ends when the user chooses the option to Ouit For thia step. the other optionrs do nothing 2) Ex: MEN u-Dpdate player rati Choose a opzion: 3) Implement the Dupur roster menu opon pt Play 1y uk: 84, Rating: 4) mplement the Upcate player ratirg menu cption Frompr the user for a playersjersey number Frompt agan for a new rating for e player, and then change that player's aing 1 Ex. Enter neu roting for player : (5) mplement re omut players above ? ning, menu option Promo: user fora reng. Pnnt the erse, numeer and ret ng for 1 ayers with ratings above the emered value (2pts Ex. ABOVE 5 lager 1Joey ber: 84, Rating:7 (6) lmplemenn the Repace player menu opoon Prampt the user for sho jersey number of the playr so roplace If the player is in the roser hen promct apain for a newjersey number and rating Update the replaced players jersey rumber and rating 12 ps) Ex 5171. Ch. 5 Program Soccer ream roster (C main.c Load defaalt templats Type your cod no.

Explanation / Answer

#include<stdio.h>

#include<stdlib.h>

static int count=0;

void print(int number[],int rating[])

{

int i;

printf("ROSTER ");

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

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

}

void main()

{

int number[10],rating[10],i,n,r,flag;

char option;

//input jersey number and rating

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

{

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

scanf("%d",&number[i]);

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

scanf("%d",&rating[i]);

printf(" ");

count++;

}

print(number,rating);

while(1)

{

printf(" ");  

printf("MENU ");

printf("u - Update player rating ");

printf("a - Output players above a rating ");

printf("r - Replace player ");

printf("o - Output roster ");

printf("q - Quit ");

printf(" ");

printf("Choose an option: ");

scanf(" %c",&option);

switch(option)

{

case 'u':

printf("Enter a jersey number: ");

scanf("%d",&n);

flag=0;

// check whether jersey number is found or not

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

{

if(number[i]==n)

{

flag=1;

break;

}

}

if(flag==1)

{

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

scanf("%d",&r);

rating[i]=r;

}

else

printf("jersey number not found to be updated ");

break;

case 'a':

printf("Enter a rating: ");

scanf("%d",&r);

flag=0;

// check whether jersey number is found or not

printf("ABOVE %d ",r);

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

{

if(rating[i]>r)

{

flag=1;

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

}

}

if(flag==0)

printf("player details not found ");

break;

case 'o':

print(number,rating);

break;

case 'q': exit(0);

default: printf("wrong choice ");

}

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote