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
Inga [223]
2 years ago
5

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 jer

sey numbers in one int array and the ratings in another int array. Output these arrays (i.e., output the roster). (3 pts)
Ex:

Enter player 1's jersey number: 84
Enter player 1's rating: 7

Enter player 2's jersey number: 23
Enter player 2's rating: 4

Enter player 3's jersey number: 4
Enter player 3's rating: 5

Enter player 4's jersey number: 30
Enter player 4's rating: 2

Enter player 5's jersey number: 66
Enter player 5's rating: 9


ROSTER
Player 1 -- Jersey number: 84, Rating: 7
Player 2 -- Jersey number: 23, Rating: 4
...
Computers and Technology
1 answer:
tiny-mole [99]2 years ago
3 0

Answer:

  1. import java.util.Scanner;
  2. public class Main {
  3.    public static void main (String [] args) {
  4.        int jersey_num [] = new int[5];
  5.        int rating [] = new int[5];
  6.        Scanner inStream = new Scanner(System.in);
  7.        for(int i=0; i < 5; i++){
  8.            System.out.print("Enter player " + (i+1) + "'s jersey number:");
  9.            jersey_num[i] = inStream.nextInt();
  10.            System.out.print("Enter player " + (i+1) + "'s rating:");
  11.            rating[i] = inStream.nextInt();
  12.        }
  13.        System.out.println("ROSTER");
  14.        for(int j=0; j < 5; j++){
  15.            System.out.println("Player " + (j+1) + "-- Jersey number: " + jersey_num[j] + ", Rating: " + rating[j]);
  16.        }
  17.    }
  18. }

Explanation:

The solution code is written in Java. Firstly create two array, jersey_num and rating, with int type. This is to hold the five pairs of numbers input by user (Line 6 -7).

Next, create a for loop that run for 5 iterations and in each iteration prompt user to input jersey number and rating (Line 11 -17). The input number and rating will be set to the array, jersey_num and rating, respectively.

Next, print the title "Roster" (Line 19).

Create another for loop to display the five input pair of values (Line 21 - 23).

You might be interested in
Design a program that asks the user to enter a store’s sales for each day of the week. The amounts should be stored in an array.
sdas [7]

Answer:

Program given below

Explanation:

Total Sales

Assign the values of the variable as “Enter the store sales for Sunday” in Sun

Assign the values of the variable as “Enter the store sales for Monday” in Mon

Assign the values of the variable as “Enter the store sales for Tuesday” in Tue

Assign the values of the variable as “Enter the store sales for Wednesday” in Wed

Assign the values of the variable as “Enter the store sales for Thursday” in Thu

Assign the values of the variable as “Enter the store sales for Friday” in Fri

Assign the values of the variable as “Enter the store sales for Saturday” in Sat

Assign the values for the variable in array as [Sun, Mon, Tue, Wed, Thu, Fri, Sat]

Initialize tot = 0

Use the loop for calculating the total sales for the week,

for total_sales in store_sales:

    tot += total_sales

then display the result as,    

print "\n Total week sales = %2.f " %tot

sun = int(input("\n Enter the store sales for Sunday: "))

mon = int(input("\n Enter the store sales for Monday: "))

tue = int(input("\n Enter the store sales for Tuesday: "))

wed = int(input("\n Enter the store sales for Wednesday: "))

thu = int(input("\n Enter the store sales for Thursday: "))

fri = int(input("\n Enter the store sales for Friday: "))

sat = int(input("\n Enter the store sales for Saturday: "))

store_sales = [sun, mon, tue, wed, thu, fri, sat]

tot = 0

for store_sale in store_sales:

tot += store_sale

print "\n Total Week Sales: %2.f" %tot

We will have the following output:

<u>OUTPUT </u>

<u> </u>Enter the store sales for Sunday: 45

Enter the store sales for Monday: 56

Enter the store sales for Tuesday: 89

Enter the store sales for Wednesday:78

Enter the store sales for Thursday: 45

Enter the store sales for Friday: 12

Enter the store sales for Saturday: 23

Total Week Sales: 348

8 0
3 years ago
WHAT DOES THE TRANSPORT LAYER USE TO MAKE SURE THAT A MESSAGE IS REASSWMBLED CORRECTLY ON THE RECEIVING DEVICES?
mrs_skeptik [129]
The answer is  sequence  number
6 0
3 years ago
Differentiate among a color display, gray scale display, and a black-and-white display​
kotykmax [81]

<u>Answer:</u>

<em>Black and white</em>:

It has only two values namely black or white. The white colour in the image will be represented as “white” and other colour part will be displayed as black.

<em>Grey-scale: </em>

Again the white part does not have a change, the black and other coloured items will be displayed in grey.

<em>Coloured image: </em>

It would display the actual colour of the image. The number of colours and shades depends on the original image from where actually it has been shooted and it also depends on the quality of the camera.

4 0
2 years ago
Locker doors There are n lockers in a hallway, numbered sequentially from 1 to n. Initially, all the locker doors are closed. Yo
kow [346]

Answer:

// here is code in C++

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

   // variables

   int n,no_open=0;

   cout<<"enter the number of lockers:";

   // read the number of lockers

   cin>>n;

   // initialize all lockers with 0, 0 for locked and 1 for open

   int lock[n]={};

   // toggle the locks

   // in each pass toggle every ith lock

   // if open close it and vice versa

   for(int i=1;i<=n;i++)

   {

       for(int a=0;a<n;a++)

       {

           if((a+1)%i==0)

           {

               if(lock[a]==0)

               lock[a]=1;

               else if(lock[a]==1)

               lock[a]=0;

           }

       }

   }

   cout<<"After last pass status of all locks:"<<endl;

   // print the status of all locks

   for(int x=0;x<n;x++)

   {

       if(lock[x]==0)

       {

           cout<<"lock "<<x+1<<" is close."<<endl;

       }

       else if(lock[x]==1)

       {

           cout<<"lock "<<x+1<<" is open."<<endl;

           // count the open locks

           no_open++;

       }

   }

   // print the open locks

   cout<<"total open locks are :"<<no_open<<endl;

return 0;

}

Explanation:

First read the number of lockers from user.Create an array of size n, and make all the locks closed.Then run a for loop to toggle locks.In pass i, toggle every ith lock.If lock is open then close it and vice versa.After the last pass print the status of each lock and print count of open locks.

Output:

enter the number of lockers:9

After last pass status of all locks:

lock 1 is open.

lock 2 is close.

lock 3 is close.

lock 4 is open.

lock 5 is close.

lock 6 is close.

lock 7 is close.

lock 8 is close.

lock 9 is open.

total open locks are :3

5 0
3 years ago
What types of forecast worksheets are available in Excel? Check all that apply.
Oksana_A [137]

Answer:

C, D

Explanation:

ya welcome:)

5 0
2 years ago
Read 2 more answers
Other questions:
  • Where is the insert function button found in microsoft excel?
    11·1 answer
  • Why it’s important to keep the standard internet protocol TCP/IP?
    11·1 answer
  • Which of the following is considered to be intellectual property?
    9·1 answer
  • A chef writing up her famed recipe for beef stew realizes she has switched parsley and oregano everywhere in the recipe. The che
    13·1 answer
  • Which federal agency enforces safety and health legislation and requires employers to be sure that adequate first-aid supplies a
    5·1 answer
  • A software development company wants to reorganize its office so that managers and the Computer Programmers they supervise can b
    13·2 answers
  • 334. Universal Containers uses a custom field on the account object to capture the account credit status. The sales team wants t
    12·1 answer
  • How has technology impacted our lives and the world we live in? In your own words.
    9·1 answer
  • Which of the following is an example of group dynamics?
    8·1 answer
  • What are the common camera hazards? When might you encounter these hazards in your life, and what do you plan to
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!