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
kolbaska11 [484]
3 years ago
13

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 in one int array and the ratings in another int array. Output these arrays (i.e., output the roster).

Ex:Enter player 1's jersey number: 84Enter player 1's rating: 7Enter player 2's jersey number: 23Enter player 2's rating: 4Enter player 3's jersey number: 4Enter player 3's rating: 5Enter player 4's jersey number: 30Enter player 4's rating: 2Enter player 5's jersey number: 66Enter player 5's rating: 9ROSTERPlayer 1 -- Jersey number: 84, Rating: 7Player 2 -- Jersey number: 23, Rating: 4...
Engineering
1 answer:
Flauer [41]3 years ago
4 0

Answer:

#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 << "Enter player " << i

            << "'s jersey number: ";

       cin >> temp;

       jerseyNumber.push_back(temp);

       cout << "Enter player " << i

            << "'s rating: ";

       cin >> temp;

       rating.push_back(temp);

       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 << "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: ";

       cin >> option;

       switch (option) {

           case 'a':

           case 'A':

               cout << "Enter a new player's"

                    << "jersey number: ";

               cin >> temp;

               jerseyNumber.push_back(temp);

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

               cin >> temp;

               rating.push_back(temp);

               break;

           case 'd':

           case 'D':

               cout << "Enter a jersey number: ";

               cin >> temp;

               int i;

               for (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
PLEASE HELP ME! THIS QUESTION IS PART OF AN ASSIGNMENT THAT IS DUE TODAY! I DON'T UNDERSTAND HOW TO DO THIS QUESTION! PLEASE HEL
matrenka [14]

Magnitudes of the currents are i1= 0.00104A , i2= 0.003641A , i3= 0.00508A.

Explanation:

Using superposition theorem,

remove the E1 voltage supply source and calculate resistance across it.

From the circuit given, as the resistances R1 and R2 are parallel

using the formula R1//R2=(R1.R2/(R1+R3)

V1= ((r1||r2)/(r1+r2||r3))*E1

v1 = (((1kΩ*680Ω)/(1kΩ+680Ω))/(3.3kΩ +((1kΩ*680Ω)/(1kΩ+680Ω)))*10v

v1= 2.3v

v2 = ((r1||r2)/(r1+r2||r3))*E2

v2 = (((1kΩ*680Ω)/(1kΩ+680Ω))/(3.3kΩ +((1kΩ*680Ω)/(1kΩ+680Ω)))*5v

v2= 1.161v

V = V1+V2

=> 2.3 + 1.161

=> 3.461v

Magnitudes of the currents can be found by i=v/r

i1 = v/r1

=> 3.461/3.3kΩ

=>0.00104A

i2=2.89/1kΩ

=>0.003461A

i3=2.89/680Ω

=> 0.00508A.

Therefore the magnitudes of the currents are i1, i2, and i3.

7 0
3 years ago
An ant starts at one edge of a long strip of paper that is 34.2 cm wide. She travels at 1.3 cm/s at an angle of 61◦ with the lon
ankoles [38]

Answer:

t = 30.1 sec

Explanation:

If the ant is moving at a constant speed, the velocity vector will have the same magnitude at any point, and can be decomposed in two vectors, along directions perpendicular each other.

If we choose these directions coincident with the long edge of the paper, and the other perpendicular to it, the components of the velocity vector, along these axes, can be calculated as the projections of this vector along these axes.

We are only interested in the component of the velocity across the paper, that can be calculated as follows:

vₓ = v* sin θ, where v is the magnitude of the velocity, and θ the angle that forms v with the long edge.

We know that v= 1.3 cm/s, and θ = 61º, so we can find vₓ as follows:

vₓ = 1.3 cm/s * sin 61º = 1.3 cm/s * 0.875 = 1.14 cm/s

Applying the definition of average velocity, we can solve for t:

t =\frac{x}{vx} = \frac{34.2 cm}{1.14 cm/s} =30.1 sec

⇒ t = 30.1 sec

7 0
3 years ago
you have a permanent magnet whit remanent induction. than you cut a piec of that magnet. if you put that piece back into permane
ELEN [110]
Yes, it will. The induction will be the same as long as it’s put back together.
5 0
4 years ago
The speed of sound in a fluid can be calculated using the following equation:
wlad13 [49]

Answer:

Jesus is always the answer

4 0
3 years ago
Ceramics has the weakness of resisting high compression force but low tensile force. a)-True b)-False
Nesterboy [21]

Answer: b) False

Explanation:Ceramic is brittle in nature therefore it has a tendency that it is strong during the compression and it tends to be weak during the high tensile forces. While the tensile forces are applied , ceramics are not able to yield the stress and cause breakage of the material due to high tension but does not face any fault during the compression.

7 0
4 years ago
Other questions:
  • In a study comparing banks in Germany and Great Britain, a sample of 145 matched pairs of banks was formed. Each pair contained
    12·1 answer
  • Describe the operation of a pneumatic robot controlled by a drum
    10·1 answer
  • Which examples demonstrate tasks commonly performed in Maintenance/Operations jobs? Check all that apply.
    11·2 answers
  • A(n) ____________ is a side view that shows height.
    12·1 answer
  • The Republican National Committee publishes a monthly digest of information for Republicans called .
    15·1 answer
  • An error was reported in a software program by a user. Before that error can be diagnosed and fixed
    5·2 answers
  • Charles, Clarissa, and Francine all work in Manufacturing. The table shows the breakdown of one day for each employee.
    5·2 answers
  • while performing a running compression test how should running compression compare to static compression
    5·1 answer
  • A European apparel manufacturer has production facilities in Italy and China to serve its European market, where annual demand i
    6·1 answer
  • This type of burn occurs when electrical current flows through tissues or bone, generating heat, and causing damage.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!