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
How has 5G become more energy efficient?
photoshop1234 [79]

Option 4. The way that 5G is more efficient is that is is able to  utilize more energy efficient access points.

What is the 5G?

This is the term that is used to refer to the fifth generation mobile network. This is the latest generation of networks and it is known to be a faster way and a more efficient way of connecting to the internet when we compare it to the others that came before it.

This is known to have lower latency when we compare it to the 4G network. It is 100 times said to be faster than the 4G and more efficient for businesses and the people that use them. Hence the The way that 5G is more efficient is that is is able to  utilize more energy efficient access points.

Read more on 5G network here: brainly.com/question/24664177

#SPJ1

7 0
2 years ago
What types of tasks can you complete using Microsoft Excel (name and describe at least 3)
FrozenT [24]

Answer:

1) Data Entry and Storage. ...

2) Accounting and Budgeting. ...

3) Collection and Verification of Business Data. ...

4) Scheduling. ...

5) Build Great Charts. ...

6) Help Identify Trends. ...

7) Administrative and Managerial Duties. ...

9) Return on Investment.

8 0
3 years ago
How many bits are in the host portion of the address 192.168.150.19/23?
Alecsey [184]
23 bits are the network mask, so 32 - 23 bits are the node number.
3 0
3 years ago
Define the following Window class:
Olenka [21]

Answer:

The following Window class are given below:

class Window  // define a class Window

{

private:   //access modifier

int width, height;   // integer type variable which is width and height

public:   //access modifier

Window(int w,int h)   //constructor that accepts two integer parameters

{

 width = w;

  height = h;

}

friend bool areSameSize(Window a, Window b)

{

 if ((a.height == b.height) && (a.width == b.width))

  return true;

 else return false;

}

};

Explanation:

According to the question: Firstly we have define a class which name is 'Window' and then we take two integer type data member and after that we have constructor that takes two integer type parameters and after all we have a areSameSize, friend function, which can take two objects and then it give output in the form of true or false, if they are the equal size and finally we check that if the width and the height  match then it returns the true and else it returns the false

3 0
4 years ago
True / False<br> An instruction’s opcode generally indicates the number and type of its operands.
liq [111]

Answer:

True

Explanation:

An opcode is the part of instruction which specifies the operation to be performed by the instruction.

In general, the opcode also provides information about the number and type of operands.

For example, let us consider the MIPS instructions for addition.

  • ADD reg_dest, reg_src1, reg_src2

This instruction adds the contents of registers reg_src1 and reg_src2 and stores the result in reg_dest.

  • Whereas, ADDI reg_src, reg_dest, value

This instruction adds the value to the content of reg_src and stores the result in reg_dest.

As we can see the opcode type indicates the operand type, number and semantics.

7 0
3 years ago
Other questions:
  • Which of the following statements are true with regards to satellite internet access
    15·2 answers
  • Acme Parts runs a small factory and employs workers who are paid one of three hourly rates depending on their shift: first shift
    5·1 answer
  • Which phrase best defines communication​
    9·1 answer
  • Which broad area of data mining applications analyzes data, forming rules to distinguish between defined classes?
    13·1 answer
  • Movie recommendations? I’m in middle school so nothing nasty bro and I don’t really like horror movies so none of those either
    13·2 answers
  • Write down the bit pattern to represent -3.75 assuming a version of this format, which uses an excess-16 format to store the exp
    14·1 answer
  • HTML question please help
    5·1 answer
  • Words that are restricted for use in object names because they belong to the SQL programming language are called _______________
    13·1 answer
  • The =COUNT function calculates what value?
    15·2 answers
  • Which mechanism will move a port into a root-inconsistent state if bpdus coming from a certain direction indicate another switch
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!