Answered step by step
Verified Expert Solution
Question
1 Approved Answer
ScoreAnalyzer.java Load defaul mport java.util.*; * TO DO: Class comment * @author * Quersion */ ublic class ScoreAnalyzer { / * @param args not used
ScoreAnalyzer.java Load defaul mport java.util.*; * TO DO: Class comment * @author * Quersion */ ublic class ScoreAnalyzer \{ / * @param args not used */ public static void main(String[] args) \{ Scanner in = new Scanner (System.in); System.out.print("How many scores to be entered?: "); int numOfResult = input. nextInt(); double[] result = getResult (input, numOfResult); double avg = findAverage(result); System.out.printf("The average is: \%.2f , average); int numAboveAverage = findNumAboveAverage(result, average); System.out.println("Number of scores above or equal to the average: " + numAboveAverage); int numBelowAverage = findNumBelowAverage(result, average); System. out.println("Number of scores below the average: " + numBelowAverage); \} public static double[] getResult(Scanner input, int length) \{ double[] result = new double[length]; for (int i=0;i i++){ System.out.print("Enter a new score: "); double score = input. nextDouble(); while (score 100 ) \{ System.out.print("Invalid. Enter a score: "); score = input. nextDouble(); \} result [i] = score; \} return result; \} public static double findAverage(double[] result) \{ double sum = 0 ; for (double score : result) \{ sum += score; \} return sum / result.length; \} public static int findNumAboveAverage(double[] result, double average) \{ int count =0; for (double score : result) \{ if (score >= average) \{ count++; \} \} return count; \} public static int findNumBelowAverage(double[] result, double average) \{ int count =0; for (double score : result) if (score count++; } return count; Failed to compile ScoreAnalyzer.java Load defaul mport java.util.*; * TO DO: Class comment * @author * Quersion */ ublic class ScoreAnalyzer \{ / * @param args not used */ public static void main(String[] args) \{ Scanner in = new Scanner (System.in); System.out.print("How many scores to be entered?: "); int numOfResult = input. nextInt(); double[] result = getResult (input, numOfResult); double avg = findAverage(result); System.out.printf("The average is: \%.2f , average); int numAboveAverage = findNumAboveAverage(result, average); System.out.println("Number of scores above or equal to the average: " + numAboveAverage); int numBelowAverage = findNumBelowAverage(result, average); System. out.println("Number of scores below the average: " + numBelowAverage); \} public static double[] getResult(Scanner input, int length) \{ double[] result = new double[length]; for (int i=0;i i++){ System.out.print("Enter a new score: "); double score = input. nextDouble(); while (score 100 ) \{ System.out.print("Invalid. Enter a score: "); score = input. nextDouble(); \} result [i] = score; \} return result; \} public static double findAverage(double[] result) \{ double sum = 0 ; for (double score : result) \{ sum += score; \} return sum / result.length; \} public static int findNumAboveAverage(double[] result, double average) \{ int count =0; for (double score : result) \{ if (score >= average) \{ count++; \} \} return count; \} public static int findNumBelowAverage(double[] result, double average) \{ int count =0; for (double score : result) if (score count++; } return count; Failed to compile
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started