1answer.
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]
3 years 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]3 years 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
John is a mechanical engineer. His first task at his job is to build any microphone of his choice. He chooses to build a dynamic
Jobisdone [24]

Answer:

A. simple to construct and easy to repair

Explanation:

A dynamic microphone works on the principle of electromagnetic principle. A diaphragm is attached to a coil of wire which helps in producing sound. Responding to the sound waves, the coil of the wire is vibrated by the diaphragm.  A magnetic field is created by the magnet which is present inside the coil of wire. The electrical signal is generated in response to the motion of the coil. The speed of the motion produces the amount of the current.

Since the construction of a dynamic microphone is easier as compared to any other microphone, John is likely to opt to build one.

7 0
2 years ago
)In a vector implementation of a stack ADT, you add an entry to the top of a stack using which vector method?
kotykmax [81]

Answer:

B.add.

Explanation:

boolean add(element)

The add method in java inserts an element in the vector.It's return type is Boolean it returns true if the element is successfully inserted in the vector and false if the operation is unsuccessful.There is no Push operation in vector.Hence we conclude that the answer is add.

8 0
3 years ago
How do I convert a number into a percentage in excel
Annette [7]

format>number>percent

Explanation:

You click the box you want to convert into a percentage and then at the top where it says file, edit, view, insert, format, data, tools, add-ons and help, click format then number and then percent. This should convert your number into a percentage.

8 0
3 years ago
The following code would include _______.
julia-pushkina [17]

Answer:

Option d is the correct answer for the above question

Explanation:

  • The above question asked about the result of the above question code, which has the query of two tables and their primary key is matched in the where class.
  • The Customer_T table has a primary key "CustomerID" and the Order_T has a foreign key "Customer_ID" and that both are matched in the where clause.
  • So the above query fetches that result in which the records match both the table. Hence Option d is the correct answer for the above question while the other is not because another option is not to get by the result of the above query.
8 0
3 years ago
All the concrete classes in the java collections framework implement _____________. the cloneable interface the comparable inter
liubo4ka [24]
Since java.util.PriorityQueue doesn't use the Cloneable interface, I think it's safe to say that Serializable interfaces are implemented in all instances.
8 0
2 years ago
Other questions:
  • Which of these is a weakness of written communication?
    8·1 answer
  • What type of survey can help a network administrator make decisions about bands, channels, and widths when installing new access
    9·1 answer
  • Which major and minor keys have no sharps or flats apex?
    5·2 answers
  • Page orientation can be either landscape or _____.
    13·1 answer
  • Sam has installed a new CPU in a client’s computer, but nothing happens when he pushes the power button on the case. The LED on
    14·1 answer
  • How to connect a three way switch to a regilar switch?
    9·1 answer
  • software that provides capabilities common across all organizations and industries is known as ________ software.
    15·2 answers
  • ____ is a method of querying and reporting that takes data from standard relational databases, calculates and summarizes the dat
    11·1 answer
  • Why is there no I do you time of day when all students should study
    10·1 answer
  • Describe psychographic differences among the past five generations of Americans that you learned about in this course. What type
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!