Question: Need help to complete this; I got 9 . 0 9 out of 1 0 Write a program that calculates the average of a sequence
Need help to complete this; I got out of
Write a program that calculates the average of a sequence of integer values entered by a user. The program must implement the following methods:
The method
prompts the user to enter the total number of integer values heshe would like to enter. The method returns the count after it is entered.
been entered.
The method conputcaverageint total, int count computes and returns the average by dividing the total of all values entered by the number of values entered which is defined by the count parameter.
The methor hows a statement with the average value to the console.
Solution
program in an IDE and check that your answers compile as expected.
class Program
public static void mainString args
int count inputCount:
int total
int average computeAverage
showAverageaverage:
J
static int inputCount
Scanner scanner new ScannerSystemin;
System.out.printlnHow many values would you like to enter?";
int count
static int inputValuesint count
int total ;
Scanner scanner new ScannerSystemin;
for int i;quad i quad i quad
System.out.printlnEnter i ;
int value scanner.nextint:
J
stati
computeAverageint total, int count
int avg
return avg:
static
showAverage
int average
System.out.printlnAverage: average;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
