Answered step by step
Verified Expert Solution
Question
1 Approved Answer
LISTING 7.1 AnalyzeNumbers.java 1 public class AnalyzeNumbers { 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
LISTING 7.1 AnalyzeNumbers.java 1 public class AnalyzeNumbers { 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]; double sum = 0; numbers[i]: System.out.print("Enter the numbers: "); for (int i = 0; i average) count++; System.out.println("Average is " + average); System.out.println("Number of elements above the average is " + 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 2. Modifications: 1. We'll have it calculate more than just the average and the number of items above it. Write code that will get the smallest value entered and the location of it in the array. 6.3 9.5 2. The output would look like this: Enter the number of items: 10 Enter the numbers 3.4 5 6 1 6.5 7.8 3.5 8.5 Average is 5.75 Number of elements above the average is 6 The smallest value entered was 1.0 The smallest value was located at index 3<>
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