Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program to help the Administration of a football league to manipulate the list of players registered in different teams. There are 26

image text in transcribed
Write a C++ program to help the Administration of a football league to manipulate the list of players registered in different teams. There are 26 teams participating in the league, each is denoted by a letter in the range A to Z. Each team can have 11 players at most. The information of all teams' players are stored in a text file named 'players.dat'. Each line from the input file contains the details of one player; where the player's details include his first-name and family-name, the age (in years), and the team's letter (from the range A - Z). --see the sample input below The intended program will perform the following tasks: Continuously displaying a menu for the user until the user selects 'X' (or 'x') to exit the program. The menu provides 4 options: Add Player (A or a), Team Inquiry (I or i), Print Statistics (P or p), and Exit (X or x). When the 'Add Player' operation is selected, the main function will ask the user to provide all the information of the new player, then it calls a user-defined function named addPlayer (...) to add the player to the file. Before the record is added to the file, two things must be checked: The provided team-letter must be in the range A - Z. This must be validated via another user-defined function named teamCodeIs Valid(...); and a suitable error message should be displayed by the function addPlayer(...) if the letter is invalid. The number of the players in the specified team must be less than 11 before adding the new player. This must be counted and returned via another user-define function named count Players(...); and a suitable error message should be displayed if the team is already full. When the 'Team Inquiry' operation is selected, the main function should ask the user to provide the letter of the desired team, then it calls a user-defined function (named displayTeam(...)) to display the details and the number of all players in the team. If the specified team has no players at all, then the function displayTeam(...) should display a suitable notification to the user. When the 'Print Statistics' operation is selected, the main function will call a user-defined function named printStat(...) to display a statistical report which shows the number of players in each team {see sample output). Write a C++ program to help the Administration of a football league to manipulate the list of players registered in different teams. There are 26 teams participating in the league, each is denoted by a letter in the range A to Z. Each team can have 11 players at most. The information of all teams' players are stored in a text file named 'players.dat'. Each line from the input file contains the details of one player; where the player's details include his first-name and family-name, the age (in years), and the team's letter (from the range A - Z). --see the sample input below The intended program will perform the following tasks: Continuously displaying a menu for the user until the user selects 'X' (or 'x') to exit the program. The menu provides 4 options: Add Player (A or a), Team Inquiry (I or i), Print Statistics (P or p), and Exit (X or x). When the 'Add Player' operation is selected, the main function will ask the user to provide all the information of the new player, then it calls a user-defined function named addPlayer (...) to add the player to the file. Before the record is added to the file, two things must be checked: The provided team-letter must be in the range A - Z. This must be validated via another user-defined function named teamCodeIs Valid(...); and a suitable error message should be displayed by the function addPlayer(...) if the letter is invalid. The number of the players in the specified team must be less than 11 before adding the new player. This must be counted and returned via another user-define function named count Players(...); and a suitable error message should be displayed if the team is already full. When the 'Team Inquiry' operation is selected, the main function should ask the user to provide the letter of the desired team, then it calls a user-defined function (named displayTeam(...)) to display the details and the number of all players in the team. If the specified team has no players at all, then the function displayTeam(...) should display a suitable notification to the user. When the 'Print Statistics' operation is selected, the main function will call a user-defined function named printStat(...) to display a statistical report which shows the number of players in each team {see sample output)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

Students also viewed these Databases questions

Question

Discuss why human resources managers need to understand strategy.

Answered: 1 week ago

Question

How to prepare washing soda from common salt?

Answered: 1 week ago

Question

Explain strong and weak atoms with examples.

Answered: 1 week ago

Question

Explain the alkaline nature of aqueous solution of making soda.

Answered: 1 week ago

Question

2. Do you find change a. invigorating? b. stressful? _______

Answered: 1 week ago

Question

10. Are you a. a leader? b. a follower? _______

Answered: 1 week ago