Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

5.17 Ch 5 Program: Soccer team roster (Java) Hello im getting errors on my if's and i dont know why heres my code import java.util.Scanner;

5.17 Ch 5 Program: Soccer team roster (Java)

Hello im getting errors on my if's and i dont know why

heres my code

import java.util.Scanner;

public class PlayerRoster { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int [] jersey = new int [5]; int [] rating = new int [5]; int runner = 0; System.out.println("Enter player 1's jersey number:"); jersey[0] = scnr.nextInt(); System.out.println("Enter player 1's rating:"); rating[0] = scnr.nextInt(); System.out.println(""); System.out.println("Enter player 2's jersey number:"); jersey[1] = scnr.nextInt(); System.out.println("Enter player 2's rating:"); rating[1] = scnr.nextInt(); System.out.println(""); System.out.println("Enter player 3's jersey number:"); jersey[2] = scnr.nextInt(); System.out.println("Enter player 3's rating:"); rating[2] = scnr.nextInt(); System.out.println(""); System.out.println("Enter player 4's jersey number:"); jersey[3] = scnr.nextInt(); System.out.println("Enter player 4's rating:"); rating[3] = scnr.nextInt(); System.out.println(""); System.out.println("Enter player 5's jersey number:"); jersey[4] = scnr.nextInt(); System.out.println("Enter player 5's rating:"); rating[4] = scnr.nextInt(); System.out.println(""); System.out.println("ROSTER"); System.out.println("Player 1 -- Jersey number: " + jersey[0] + ", " + "Rating: " + rating[0]); System.out.println("Player 2 -- Jersey number: " + jersey[1] + ", " + "Rating: " + rating[1]); System.out.println("Player 3 -- Jersey number: " + jersey[2] + ", " + "Rating: " + rating[2]); System.out.println("Player 4 -- Jersey number: " + jersey[3] + ", " + "Rating: " + rating[3]); System.out.println("Player 5 -- Jersey number: " + jersey[4] + ", " + "Rating: " + rating[4]); System.out.println(""); 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"); System.out.println(""); System.out.println("Choose an option:"); String s = scnr.next();

while (runner aboveRating) {System.out.println("Player 1 -- Jersey number: " + jersey[0] + " Rating: " + rating[0]);} if (rating[1] > aboveRating) {System.out.println("Player 1 -- Jersey number: " + jersey[1] + " Rating: " + rating[1]);} if (rating[2] > aboveRating) {System.out.println("Player 1 -- Jersey number: " + jersey[2] + " Rating: " + rating[2]);} if (rating[3] > aboveRating) {System.out.println("Player 1 -- Jersey number: " + jersey[3] + " Rating: " + rating[3]);} if (rating[4] > aboveRating) {System.out.println("Player 1 -- Jersey number: " + jersey[4] + " Rating: " + rating[4]);} s = scnr.next(); } else if (b

} static int charToInt(char c) { return "uaroq".indexOf(c); } }

my errors

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Press F11 to exit full screen 4. Compare output 84 7 23 4 4 5 nput 302 66 9 ROSTEER Player Jer Player 2Jer Player 3Jer Player 4-Jer Player 5Jer Jersey number: 84, Rating: 7 Jersey number: 23, Rating: 4 Jersey number: 4, Rating: 5 Jersey number: 30, Rating: 2 Jersey number: 66, Rating: 9 MENU u Update player rating a Output players above a rating r - Replace player Your output ends with o Output roster uit Choose an option:J ROSTERJ Player 1 Jersey number: 84, Rating:7 Player 2Jersey number: 23, Rating: 4J Player 3 Jersey number: 4, Rating: 5 Player 4Jersey number: 30, Rating:2 Player 5Jersey number: 66, Rating: 9J ROSTER

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administration The Complete Guide To Dba Practices And Procedures

Authors: Craig S. Mullins

2nd Edition

0321822943, 978-0321822949

More Books

Students also viewed these Databases questions

Question

Explain the steps involved in training programmes.

Answered: 1 week ago

Question

What are the need and importance of training ?

Answered: 1 week ago

Question

What is job rotation ?

Answered: 1 week ago

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago