Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ScoreAnalyzer.java Load defaul mport java.util.*; * TO DO: Class comment * @author * Quersion */ ublic class ScoreAnalyzer { / * @param args not used

image text in transcribedimage text in transcribedimage text in transcribed

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

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_2

Step: 3

blur-text-image_3

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

MongoDB Applied Design Patterns Practical Use Cases With The Leading NoSQL Database

Authors: Rick Copeland

1st Edition

1449340040, 978-1449340049

Students also viewed these Databases questions

Question

Describe alternative training and development delivery systems.

Answered: 1 week ago

Question

Define Management by exception

Answered: 1 week ago

Question

Explain the importance of staffing in business organisations

Answered: 1 week ago

Question

What are the types of forms of communication ?

Answered: 1 week ago

Question

Explain the process of MBO

Answered: 1 week ago