Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This program will store roster and rating information for a soccer team like you completed for a previous lab But for this version each menu

This program will store roster and rating information for a soccer team like you completed for a previous lab But for this version each menu option should be written as a function that will be called when the associated menu option is entered. You will also put the code to enter the initial team players into a function. That function will prompt the user for how many players to initially add. The function will add all of the player information into the arrays, call the printRoster() function, and return how many players were added.

The other change is that this version will also support entering a name for each player in addition to the jersey number and ranking supported in the previous version.

Note that output format for the print roster function has also been changed - see example below.

The menu listing and logic to process each possible choice will be in the main() function.

(1) Implement a menu of options for a user to modify the roster. Each option is represented by a single character. The program initially outputs the menu, and outputs the menu after a user chooses an option. The program ends when the user chooses the option to Quit. For this step, the other options do nothing. (2 pts) Ex:

MENU a - Add player d - Remove player u - Update player rating r - Output players above a rating o - Output roster q - Quit Choose an option: 

(2)Implement a function to allow he user to enter the initial roster. Prompt the user for how many players to add, then promt for: A player's name (first name only), A player's jersey number (0 - 99) and the player's rating (1 - 9). Store the name in one string array, the jersey numbers in one int array and the ratings in another int array. Call the printRoster() function before returning the number of players added to the main( ) function. Call your new function before you print out the Menu. (4 pts)

HINT: use << std::left << std::setw(10) as the first arguments of your cout statement in the printRoster( ) function to line up the columns in the roster output.

Ex:

Enter number of players to add: 2 Enter player's name: Sue Enter Sue's jersey number: 23 Enter Sue's rating: 9 Enter player's name: Steve Enter Steve's jersey number: 37 Enter Steve's rating: 7 ROSTER: Player Jersey # Rating Sue 23 9 Steve 37 7 MENU a - Add player d - Remove player u - Update player rating r - Output players above a rating o - Output roster q - Quit Choose an option: ... 

(3) Implement the "Output roster" menu option. (1 pt)

This should be very simple to do as you can just call the same printRoster( ) function you wrote for step (2). Ex:

ROSTER: Player Jersey # Rating Sue 23 9 Steve 37 7 ... 

(4) Implement the "Add player" menu option. Prompt the user for a new player's jersey number and rating. Add the values to the two arrays. (1 pt) Ex:

Enter a new player's name: sue Enter a new player's jersey number: 49 Enter the player's rating: 8 

(5) Implement the "Delete player" menu option. Prompt the user for a player's jersey number. Remove the player from the roster (delete the jersey number and rating). (2 pts) Ex:

Enter a jersey number: 4 

(6) Implement the "Update player rating" menu option. Prompt the user for a player's jersey number. Prompt again for a new rating for the player, and then change that player's rating. (1 pt) Ex:

Enter a jersey number: 23 Enter a new rating for player: 6 

(7) Implement the "Output players above a rating" menu option. Prompt the user for a rating. Print the jersey number and rating for all players with ratings above the entered value. (2 pts) Ex:

Enter a rating: 5 ABOVE 5 Player 1 -- Jersey number: 84, Rating: 7 ...

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part I Lnai 8724

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448475, 978-3662448472

More Books

Students also viewed these Databases questions