Question: import java.util.Scanner; public class ScoreAnalyzer { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print(How many scores to be entered?: ); int

import java.util.Scanner;

public class ScoreAnalyzer { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("How many scores to be entered?: "); int numScores = in.nextInt(); double[] scores = getScores(in, numScores); double average = findAverage(scores); int scoresAbove = countScoresAbove(scores, average); int scoresBelow = countScoresBelow(scores, average); System.out.println("The average is: " + average); System.out.println("Number of scores above or equal to the average: " + scoresAbove); System.out.println("Number of scores below the average: " + scoresBelow); }

public static double[] getScores(Scanner in, int numScores) { double[] scores = new double[numScores]; for (int i = 0; i 100) { System.out.println("Invalid. Enter a score: "); score = in.nextDouble(); } scores[i] = score; } return scores; }

public static double findAverage(double[] scores) { double sum = 0; for (int i = 0; i

public static int countScoresAbove(double[] scores, double average) { int count = 0; for (int i = 0; i = average) { count++; } } return count; }

public static int countScoresBelow(double[] scores, double average) { int count = 0; for (int i = 0; i

Here my code and here my result vs expected output. Please fix my code to match expected output, Thanksimport java.util.Scanner; public class ScoreAnalyzer { public static void main(String[] args) {Scanner in = new Scanner(System.in); System.out.print("How many scores to be entered?: ");int numScores = in.nextInt(); double[] scores = getScores(in, numScores); double average =findAverage(scores); int scoresAbove = countScoresAbove(scores, average); int scoresBelow = countScoresBelow(scores, average); System.out.println("The

new score: Enter a new score: Enter a new score: The average is: 82.025 Enter a new score: Enter a new score: The average is: 74.83000000000001 Your output a new score: Enter a new score: Enter a new score: The average is: 74.0 Expected output r a new score: Enter a new score: The average is: 82.88000000000001 Your output or equal to the average: 3 the average: 2 a new score: Enter a new score: Enter a new score: The average is: 82.0 Expected output anewscore:Enteranewscore:Enteranewscore:Theaverageis:76.05 Your output anewscore:Enteranewscore:Enteranewscore:Theaverageis:75.0 Expected output

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!