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

District maintains five soccer teams, as shown in the table below. Write the pse

ID: 673603 • Letter: D

Question

District maintains five soccer teams, as shown in the table below. Write the pseudocode for a program that accepts a player’s team number as the player registers to be on the team and displays the player’s team name continuously until an appropriate sentinel value is entered for a team number. In addition,  after the sentinel value has been entered, the program displays (output) a count of the number of players registered for each team along with the team number and the team name. Be sure to use Modules!

Explanation / Answer

class soccer
{
public:
string members[50];   //considering maximum number of player ,can register is 50
int count;
string team_name;
  
soccer()
{
for(int i=0;i<50;i++)
members[i]=NULL;
count=0;
}
  
void registar()
{
cout<<"Enter the name to register to this team"<<endl;
string player;
cin>>player;
members[count++]=player;
}
  
};

class district
{
public:
soccer teams[5];
district()
{
//intialising the name of 5 teams
teams[0].team_name="A";
teams[1].team_name="B";
teams[2].team_name="C";
teams[3].team_name="D";
teams[4].team_name="E";
}
  
void registration()
{
cout<<"Enter the team number you wanna in : ";
int num;
cin>>num;
//considering -1 as sentinel value
while(num!=-1)
{
team[num].registar();
//displaying team name
cout<<"You registered in : "<<teams[num].team_name<<endl;
cout<<"Enter the team number you wanna in : ";
cin>>num;
}
//after encountering sentinel value in place of team number
//displaying all registered in different teams
  
for(int i=0;i<5;i++)
{
int c=teams[i].count;
cout<<"Number of players in team :"<<teams[i].team_name<<" is "<<c<<" with team number "<<i<<endl;
}
  
}
  
};

//here to execute we just call registration() of district class , above is the pseudo code of this question( with two classes) .