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]
2 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]2 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
You and a few friends are having a meal at a pizza restaurant, and the server has just given you the bill. Write a function that
cestrela7 [59]

Answer:

How to calculate the total cost of the meal

For bill inclusive of tax, cost1=cost*(1+tax percentage)

For bill inclusive of tax and tip, cost2=cost1*(1+tip percentage)

Meal cost =(pizza cost*(1+tax percentage))*(1+tip percentage)

Now how to calculate the cost per person

cost per person=meal cost/ number of people.

C language code to solve the above problem is given below with appropriate comments for explanation

Explanation:

#include<stdio.h>

float split_bill(int cost,float tax)

{

//Declaring number of people as int

int number;

//Prompting for number of people

printf("Enter number of people ");

scanf("%d",&number);

//Declaring tip percentage as float

float tip_percent;

//Prompting for tip percentage

printf("Enter tip percentage between 0 and 1 ");

scanf("%f",&tip_percent);

//Calculating total meal cost

float meal=(((float)cost)*(1+tax))*(1+tip_percent);

//Printing total cost of meal

printf("Total cost of meal: %0.2f ",meal);

//Calculating cost per person

float cost_per_person=meal/number;

//Returning cost per person to main function

return cost_per_person;

}

int main()

{

//Declaring pizza cost as int and tax percentage as float

int pizza_cost;

float tax_percent;

//Prompting user for pizza cost

printf("Enter billing amount of pizza ");

scanf("%d",&pizza_cost);

//Prompting user for tax percentage

printf("Enter tax percentage between 0 and 1 ");

scanf("%f",&tax_percent);

//Printing the cost per person by calling the function split_bill

printf("Total cost per person is: %0.2f ",split_bill(pizza_cost,tax_percent));

return 0;

}

8 0
2 years ago
Is Conflict Healthy ?<br>​
Vesna [10]

yes

Explanation:

because it has more things

6 0
2 years ago
Read 2 more answers
Plz help, correct answer will get brainliest (if i can, if i can't ill still rate and give thanks)
Elena-2011 [213]

Answer:

E-book : online edition of a new novel .

e-zine:online issue of today’s newspaper.

Online reference: online encyclopedia

blog: online website that posts restaurants reviews

Explanation:

Are you doing edge?

Also pleaseeeeeeeeeeeeeeeeeee mark me brainliest.

6 0
2 years ago
Declare a character variable letterStart. Write a statement to read a letter from the user into letterStart, followed by stateme
oee [108]
  1. Answer: import java.util.Scanner; public class CharTestt {     public static void main(String[] args) {     System.out.println("Please enter a character ");     Scanner input = new Scanner(System.in);     char letterStart = input.next().charAt(0);     char thenextChar = (char)(letterStart+1);     System.out.print(letterStart);     System.out.println(thenextChar); } } Explanation: Import Scanner Class Prompt user to enter a character Read and save user's input in a variable char letterStart = input.next().charAt(0); Knowing that the next character using ASCII is +1, create a new character variable and add 1 print the character entered and the new character all on same line without spaces
5 0
3 years ago
Write a basic program that performs simple file and mathematical operations.
Ostrovityanka [42]

Answer:

Explanation:

I have written the Python program based on your requirements.

Just give the path of the input file and the path for the output file correctly where you want to place the output file.

In, my code - I have given my computer's path to the input and output file.

You just change the path correctly

My code works perfectly and I have tested the code with your inputs.

It gives the exact output that you need.

I have attached the Output that I got by running the below program.

Code:

month_list={ "january":"1","february":"2", "march":"3","april":"4", "may":"5", "june":"6","july":"7", "august":"8", "september":"9","october":"10", "november":"11", "december":"12"} input_file=open('C:\\Users\\Desktop\\inputDates.txt', 'r') output_file=open('C:\\Users\\Desktop\\parsedDates.txt','w') for each in input_file: if each!="-1": lis=each.split() if len (lis) >=3: month=lis [0] day=lis[1] year=lis [2] if month.lower() in month_list: comma=day[-1] if comma==',': day=day[:len (day)-1] month_number=month_list[month.lower()] ans-month_number+"/"+day+"/"+year output_file.write (ans) output_file.write("\n") output_file.close() input_file.close()

- O X parsedDates - Notepad File Edit Format View Help 3/1/1990 12/13/2003

- X inputDates - Notepad File Edit Format View Help March 1, 1990 April 2 1995 7/15/20 December 13, 2003 -1

cheers i hope this helped !!

7 0
3 years ago
Other questions:
  • What does a sharp sign indicate when used in representing a pitch?
    10·1 answer
  • You are manually configuring a tcp/ip host. another administrator gives you the router's ip address. what is the tcp/ip term for
    6·2 answers
  • The page orientation in which the page width is greater than the page height is called
    8·1 answer
  • Digital certificates can be used for each of these EXCEPT _____. A. to encrypt channels to provide secure communication between
    13·1 answer
  • CodeHS 3.4.5. What is the code for four colored triangles.
    8·1 answer
  • Write SQL statements for the following: 1. 2. 3. Change the column Z of a table XYZ to now acceptdefault value 9999 Delete a tab
    8·1 answer
  • Networking and telecommunications technologies, along with computer hardware, software, data management technology, and the peop
    5·1 answer
  • A keyboard would be considered _____. Select 2 options.
    13·2 answers
  • QueSUUN TU
    15·1 answer
  • Can someone help me answer this, I can’t fail tysm :)
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!