answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
11Alexandr11 [23.1K]
1 year ago
5

This program will store roster and rating information for a soccer team. Coaches rate players during tryouts to ensure a balance

d team. (1) Prompt the user to input five pairs of numbers: A player's jersey number (0 - 99) and the player's rating (1 - 9). Store the jersey numbers and the ratings in a dictionary. Output the dictionary's elements with the jersey numbers in ascending order (i.e., output the roster from smallest to largest jersey number). Hint: Dictionary keys can be stored in a sorted list.
Computers and Technology
1 answer:
aleksandr82 [10.1K]1 year ago
6 0

Answer:

Question Options :

(1) Prompt the user to input five pairs of numbers: A player’s jersey number (0 – 99) and the player’s rating (1 – 9). Store the jersey numbers in one int array and the ratings in another int array. Output these array(i.e., output the roster).

(2) 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 pt)

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

(4) Implement the “Add player” menu option. Prompt the user for a new player’s jersey number and rating. Append the values to the two arrays. (1 pt)

(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)

(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)

(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)

/******************************************************************************

This program will store roster and rating information for a soccer team.

                             

*******************************************************************************/

#include <iostream>

#include <vector>

using namespace std;

int main() {

   vector< int> jerseyNumber;

   vector< int> rating;

   int temp;

   for (int i = 1; i <= 5; i++) {

       cout << "\nEnter player " << i << "'s jersey number: ";

       cin >> temp;

       if ((temp >= 0) && (temp <= 99)){

           jerseyNumber.push_back(temp);}

       cout << "Enter player " << i << "'s rating: ";

       cin >> temp;

       if ((temp >= 0) && (temp <= 9)){

       rating.push_back(temp);}

       cout << endl;

   } cout << endl;

   cout << "ROSTER" << endl;

   for (int i = 0; i < 5; i++)

cout << "Player " << i + 1 << " -- " << "Jersey number: " << jerseyNumber.at(i) << ", Rating: " << rating.at(i) << endl;

   char option;

   while (true) {

       cout << endl;

       cout << "MENU" << endl;

       cout << "a - Add player" << endl;

       cout << "d - Remove player" << endl;

       cout << "u - Update player rating" << endl;

       cout << "r - Output players above a rating" << endl;

       cout << "o - Output roster" << endl;

       cout << "q - Quit" << endl << endl;

       cout << "Choose an option: " << endl;

       cin >> option;

       switch (option) {

           case 'a':

           case 'A':

               cout << "Enter another player's jersey number: " << endl;

               cin >> temp;

               if ((temp >= 0) && (temp <= 99)){

                   jerseyNumber.push_back(temp);}

               cout << "Enter another player's rating: " << endl;

               cin >> temp;

               if ((temp >= 0) && (temp <= 9)){

                   rating.push_back(temp);}

               break;

           case 'd':

           case 'D':

               cout << "Enter a jersey number: ";

               cin >> temp;

               for (int i = 0; i < jerseyNumber.size(); i++) {

                   if (jerseyNumber.at(i) == temp) {

                       jerseyNumber.erase(jerseyNumber.begin() + i);

                       rating.erase(rating.begin() + i);

                       break; }

               } break;

           case 'u':

           case 'U':

               cout << "Enter a jersey number: ";

               cin >> temp;

               for (int i = 0; i < jerseyNumber.size(); i++) {

                   if (jerseyNumber.at(i) == temp) {

                       cout << "Enter a new rating " << "for player: ";

                       cin >> temp;

                       rating.at(i) = temp;

                       break; }

               } break;

           case 'r':

           case 'R':

               cout << "Enter a rating: ";

               cin >> temp;

               cout << "\nABOVE " << temp << endl;

               for (int i = 0; i < jerseyNumber.size(); i++)

                   if (rating.at(i) > temp)

               cout << "Player " << i + 1 << " -- " << "Jersey number: " << jerseyNumber.at(i)

               << ", Rating: " << rating.at(i) << endl;

               break;

           case 'o':

           case 'O':

               cout << "ROSTER" << endl;

               for (int i = 0; i < jerseyNumber.size(); i++)

               cout << "Player " << i + 1 << " -- " << "Jersey number: " << jerseyNumber.at(i)

               << ", Rating: " << rating.at(i) << endl;

               break;

           case 'q':

               return 0;

               default: cout << "Invalid menu option." << " Try again." << endl;

       }

     }

   }

Explanation:

You might be interested in
What advantage do ExpressCard modules and USB adapters offer over expansion cards?
ss7ja [257]
<span>ExpressCard modules and USB adapters are faster and smaller. They are easier to plug into a computer and allow a person to add memory, wired and wireless communications, multimedia, and security features by inserting the small card or adapter into a small slot in the computer.</span>
3 0
1 year ago
An administrator has been working within an organization for over 10 years. He has moved between different IT divisions within t
rodikova [14]

Answer:

User roles and access authorization

(Explanation of this question is given below in the explanation section.

Explanation:

As noted in question that a terminated employee comeback in office and installed some malicious script on a computer that was scheduled to run a logic bomb on the first day of the following month. And, that script will change administrator passwords, delete files, and shut down over 100 servers in the data center.

The following problem can be with that account

  • Unauthorized user access and privileges

The user may be given unauthorized access to system resources. If a user has unauthorized access to system resource then he can modify or destroy the system function easily.

  • The firewall may be disabled to detect the malicious script

The firewall should be enabled to detect such types of attack from unauthorized access to the system

  • Role

May be user role is not defined properly. If role would be defined according to user role then there are very fewer chances in doing unauthorized changes in the system that will result in an unexpected outage.

5 0
2 years ago
Which sources could provide reliable evidence for your claim? Check all that apply. a step-by-step guide listed at www.gettingto
kozerog [31]
The correct answer is:
<span>an article from the New York Times</span>a book by an educational researcher and  professor<span>a report from the US Department of Education at www.ed.gov</span>
7 0
1 year ago
Read 2 more answers
Kayle is building a web form. He has included space where users can input their phone numbers and email addresses. However, he w
Digiron [165]

Answer:

D. javascript

Explanation:

use form validation method bro

8 0
1 year ago
Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both floats) as input, and output the ga
Ierofanga [76]

Answer:

x^{2} \left[\begin{array}{ccc}1&2&3\\4&5&6\\7&8&9\end{array}\right] \int\limits^a_b {x} \, dx  \lim_{n \to \infty} a_n \sqrt{x} \sqrt[n]{x} \pi \alpha \frac{x}{y} x_{123} \beta

Explanation:

6 0
1 year ago
Read 2 more answers
Other questions:
  • What helps companies and organizations to target masses of people, provide 24/7 services, and deliver better marketing in a chea
    13·2 answers
  • A class car and its subclass bmw each have a method run(), which was written by the developer as part of the class definition. i
    10·1 answer
  • Edward has started up a new company with his friend, Matthew. Currently, he has only two people working with him. Which type of
    8·1 answer
  • How many times does the following loop execute?int upperCaseLetters = 0;String str = "abcdEfghI";boolean found = false;for (int
    5·1 answer
  • Create an abstract Division class with fields for a company's division name and account number, and an abstract display() method
    14·1 answer
  • A company moves a popular website to a new web host. Which of the following will change as a result?
    15·1 answer
  • While Angela is making modifications to Katie’s Word document, she would like to inform Katie of the reasoning for the change. W
    10·1 answer
  • The terminal window wants to evaluate your current bash knowledge by using the ~/workspace/nested-directories folder:
    15·1 answer
  • Select the correct navigational path to freeze the top row of your worksheet. Select the panes you wish to freeze. Click the tab
    15·2 answers
  • Which 2 problems does the Pay down credit card workflow solve for clients? (Select all that apply) It helps clients stay on top
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!