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
Elena L [17]
3 years ago
7

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). (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:
aksik [14]3 years ago
5 0

Answer:

import java.util.Scanner;

public class TeamRoster {

  public static void main(String[] args) {

     Scanner scan = new Scanner(System.in);

     int[][] players = new int[5][2];

     boolean keepAlive = true;

     char input;

     

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

        System.out.println("Enter player " + (i+1) + "'s jersey number: ");

        players[i][0] = scan.nextInt();

        if( players[i][0] >= 0 && players[i][0] < 100 ) {

             System.out.println("Enter player number less than 100");

               System.out.println("Enter player " + (i+1) + "'s rating: ");

               players[i][1] = scan.nextInt();

               if ( players[i][1] >= 1 && players[i][1] <10 ) {

                     System.out.println();

               }    else {

                     System.out.println("Enter player " + (i+1) + "'s rating: ");

                     players[i][1] = scan.nextInt();

               }

     }

     }

     System.out.println();

     outputRoster(players, 0);

     

     while (keepAlive) {

        outputMenu();

        input = scan.next().charAt(0);

        if (input == 'q') {

           keepAlive = false;

           break;

        } else if (input == 'o') {

           outputRoster(players, 0);

        } else if (input == 'u') {

           System.out.println("Enter a jersey number: ");

           int jerseyNum = scan.nextInt();

           System.out.println("Enter a new rating for the player: ");

           int newRating = scan.nextInt();

           for (int l = 0; l < 5; l++) {

              if (players[l][0] == jerseyNum) {

                 players[l][1] = newRating;

              }

           }

        } else if (input == 'a') {

           System.out.println("Enter a rating: ");

           int rating = scan.nextInt();

           outputRoster(players, rating);

        } else if (input == 'r') {

           System.out.println("Enter a jersey number: ");

           int jerseyNum = scan.nextInt();

           boolean exists = true;

           for (int l = 0; l < 5; l++) {

              if (players[l][0] == jerseyNum) {

                 System.out.println("Enter a new jersey number: ");

                 players[l][0] = scan.nextInt();

                 System.out.println("Enter a rating for the new player: ");

                 players[l][1] = scan.nextInt();

              }

           }

           

        }

     }

     

     return;

  }

   

  public static void outputRoster(int[][] players, int min) {

     System.out.println(((min>0) ? ("ABOVE " + min) : ("ROSTER")));

     int item = 1;

     for (int[] player : players) {

        if (player[1] > min) {

           System.out.println("Player " + item + " -- Jersey number: " + player[0] + ", Rating: " + player[1]);

        }

        item++;

     }

     System.out.println();

  }

   

  public static void outputMenu() {

     System.out.println("MENU");

     System.out.println("u - Update player rating");

     System.out.println("a - Output players above a rating");

     System.out.println("r - Replace player");

     System.out.println("o - Output roster");

     System.out.println("q - Quit\n");

     System.out.println("Choose an option: ");  

  }

}

Explanation:

The program is written in Java.

It is a bit straightforward.

The Scanner module is declared and used to collect input from the user.

The program prompts the user for each player jersey then rating.

All five players details are collected.

The program shows the output of all the entries.

You might be interested in
An acceptable website design is one that meets
Harman [31]

Answer:

i'd say b

Explanation:

5 0
2 years ago
Read 2 more answers
In which conditions, a trial balance does not tally?
Nostrana [21]

Answer:

A trial balance will not balance if both sides do not equal, and the reason has to be explored and corrected.

Explanation:

The debit side and the credit side must balance, meaning the value of the debits should equal the value of the credit

4 0
2 years ago
Write code that declares a variable named minutes, which holds minutes worked on a job,
Mamont248 [21]

The code that carried out the functions indicated above is stated below. It is not be noted that the code is written in C#

<h3>What is C#</h3>

C# is a type-safe, object-oriented programming language. It is pronounced "see sharp"

<h3>What is the code for the above task?</h3>

Using System;            

public class HoursAndMinutes

{

   public static void Main()

   {

      // declaring minutes variable and assigning 197 as given in question

       int minutes = 197;

     // outputing the total minutes , hours

       Console.WriteLine("{0} minutes is {1} hours and {2} minutes.", minutes, minutes/60, minutes%60);

   }

}

// OUT

Learn more about C#:
brainly.com/question/20211782
#SPJ1

8 0
2 years ago
A user has a network device that streams media to the LAN. The device is visible on the network. All PCs on the LAN can ping the
trasher [3.6K]

Answer: A. Multicast

Explanation:

Here we are given a situation where it is necessary for the device to stream media to all the PCs connected across the LAN. But as the they are unable to stream the media then it is a problem in the multicast TCP/Ip technology.

Multicasting enables to transfer information or messages from one to many or many to many. Here as a single device is responsible for streaming the content to other PCs across the LAN, therefore it is necessary that multicast has been properly implemented.

Option B is incorrect as it is not a scenario of broadcast as in broadcasting all the receivers must get the streaming however here if a PC does not want to receive the media stream it cannot receive for which multicasting is required.

Option C is incorrect as here we are not talking of one to one communication.

Option D is incorrect as here we cannot have more than one route to send the media content except the LAN.

5 0
3 years ago
The process of _____ determines what volume a system can handle by comparing its performance to standards in the industry? horiz
Alina [70]

BENCHMARKING

option C

5 0
3 years ago
Read 2 more answers
Other questions:
  • These devices: monitor, earphone, speakers are examples of what? Input devices Storage devices Output devices All answer are cor
    10·2 answers
  • In the context of Information Technology Infrastructure Library, _____ delivers information technology IT services on an ongoing
    14·1 answer
  • Convert the binary number into a hexadecimal number.
    7·1 answer
  • Write a SELECT statement that selects all of the columns for the catalog view that returns information about foreign keys. How m
    6·1 answer
  • After conducting interviews with several bad candidates, Althea, a manager at Langrover Inc. interviewed a candidate who was bet
    15·1 answer
  • When you take action independent of direct instruction, you are showing _____.
    11·1 answer
  • Sites like Zillow get input about house prices from a database and provide nice summaries for readers. Write a program with two
    12·1 answer
  • AJ created a list, and he needs all of the numbers to be in order. Which Python function will allow him to organize his list num
    5·2 answers
  • A ……………………………is used to verify the identity of a website and is issued to the owner of the website by an independent and recogni
    7·2 answers
  • What does ATM mean on lego mario mean I know that this is not school related but I trying to help my brother ​
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!