Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem: a java program using arrays to solve the problem: to read 100 numbers, get the average of these numbers, and find the number of

Problem: a java program using arrays to solve the problem: to read 100 numbers, get the average of these numbers, and find the number of the items greater than the average. To be flexible for handling any number of input, we will let the user enter the number of input, rather than fixing it to 100.Filename: AnalyzeNumbers.java

image text in transcribed
Let's Check: { Answer Key) LISTING 7.1 AnalyzeNumbers . java public class AnalyzeNumbers { UN public static void main(String args) { numbers[0] java.util. Scanner input = new java.util. Scanner(System. in) ; numbers[1]: System. out. print("Enter the number of items: "); numbers[2]: int n = input. nextInt(); double numbers = new double[n] ; create array double sum = 0; numbers[i]: 9 System. out. print("Enter the numbers: "); 10 for (int i = 0; i average) above average? 20 count++; 21 22 System. out. printIn("Average is " + average); 23 System. out. printIn("Number of elements above the average is " 24 + count) ; 25 26 Enter the number of items: 10 ~Enter Enter the numbers: 3.4 5 6 1 6.5 7.8 3.5 8.5 6.3 9.5 -Enter Average is 5.75 Number of elements above the average is 6 The program prompts the user to enter the array size (line 5) and creates an array with the specified size (line 6). The program reads the input, stores numbers into the array (line 11), adds each number to sum in line 11, and obtains the average (line 15). It then compares

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

Transport Operations

Authors: Allen Stuart

2nd Edition

978-0470115398, 0470115394

Students also viewed these Programming questions

Question

Show that the result in (33.19) is correct..

Answered: 1 week ago