Question: JAVA Experiment 2: Actual Combat of Array Common Algorithms You need the array_labs directory, which contains the experiment code, provided by the teacher, please put

JAVA Experiment 2: Actual Combat of Array Common Algorithms You need the array_labs directory, which contains the experiment code, provided by the teacher, please put this folder under package chapter3. Activity 1: Cumulative summation of array elements Write a program that allows users to enter 5 numbers, and then calculate their average value and the number of numbers greater than the average value. The program effect is as follows:

JAVA Experiment 2: Actual Combat of Array Common Algorithms You need the

The basic structure of the program is shown below, complete with other codes to achieve the above functions.

public class AnalyzeNumbers { public static void main(String[] args) { Scanner input = new Scanner( System.in); System.out.println("Enter 5 numbers:"); //Decalare an array to store user input int[] nums = new int[5]; nums[0] = input.nextInt(); nums[1] = input.nextInt(); nums[2] = input.nextInt(); nums[3] = input.nextInt(); nums[4] = input.nextInt();

//other codes

}

}

Enter 5 numbers: 65 89 67 77 56 Average of all numbers is: 70.8 Number of elements above average is: 2

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!