Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

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

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

Database Systems Design Implementation And Management

Authors: Peter Robb,Carlos Coronel

5th Edition

061906269X, 9780619062699

More Books

Students also viewed these Databases questions

Question

Have ground rules been established for the team?

Answered: 1 week ago