Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ please, using basic programming one coding The main menu should show the available options: Show the roster : Displays all the player names

In C++ please, using basic programming one coding

The main menu should show the available options:

Show the roster: Displays all the player names and jersey numbers in a numbered list. Ex: 1. Susan Martinez (33), 2. Jake Smith (21), etc.

Add a player: Prompts the user to type the player's full name and jersey number. Then adds the player to the roster.

Remove a player: Displays the roster and prompts the user to enter the number of the player to remove. Then removes the player from the roster.

Quit: Quits the program.

The program should display the main menu after the user shows the roster, adds a player, or removes a player. The program only terminates when the user chooses the quit option.

Data validation should be used where appropriate. Ex: The user should not be able to choose an option that doesn't exist or delete a player that doesn't exist.

The roster should be kept in alphabetic order by the players' full names. Ex: If Alice Chang (9) is added to a roster with Jake Smith and Susan Martinez, Alice would become the first person in the roster since "A" comes before "J" in Jake. If Zack Nugen is then added, Zack would be the last person in the roster because "Z" comes after "S" in Susan.

When the program first starts, the roster should be randomly generated:

The number of players should be randomly selected between 5 and 10.

The first and last names of each player should be randomly generated from a list of at least 20 possible first names and 20 possible last names.

The jersey number should be randomly assigned a number between 1 and 99.

It's possible to have two randomly generated players with the same names and numbers, so don't worry about enforcing uniqueness.

C++ program requirements:

Two parallel vectors declared in main() must be used to store the player names and jersey numbers.

Use functions where appropriate that are named well with each serving a single purpose.

Seed the random number generator appropriately, and use rand() to randomly generate the initial roster.

Create two vectors of possible first names and last names to help generate the random player names.

Use the vector.erase() function to remove a player from the player names and jersey number vectors. (Do some online searching to discover how vector.erase() works, and cite the URL in a C++ comment above the call to vector.erase() where you find the information.)

Use a sorting algorithm to keep the parallel vectors in ascending order by player name.

In addition to storing player names and jersey numbers, create a third vector that stores the player's position. The position should be created using an enumerated type. Ex: vector playerPositions where Position is the enum. Include the position as part of the roster output.

Create a unit test that adequately tests one of your functions. Functions that produce output, receive input, or produce random numbers are not good functions to test. Functions that return a value or change a reference parameter are good functions to test. Your unit test with assert() calls should be in a function called UnitTest().

What are "qns"

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

Understanding Databases Concepts And Practice

Authors: Suzanne W Dietrich

1st Edition

1119827949, 9781119827948

More Books

Students also viewed these Databases questions

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago