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

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:

o The provided team-letter must be in the range A-Z. This must be validated via another user- defined function named teamCodeIsValid(...); and a suitable error message should be displayed by the function addPlayer(...) if the letter is invalid.

o 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 countPlayers(...); 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). HINT: CONSIDER USING THE FUNCTION countPlayers(...).

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

Step: 3

blur-text-image

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

Databases Illuminated

Authors: Catherine M. Ricardo

1st Edition

0763733148, 978-0763733148

More Books

Students also viewed these Databases questions

Question

Main memory is also called optical storage. True False

Answered: 1 week ago