Question: USING ONLY THE SCANNER CLASS 2. Write a program called StatisticsCalculator that calculates the mean (average) and standard deviation for a set of integer values
USING ONLY THE SCANNER CLASS

2. Write a program called StatisticsCalculator that calculates the mean (average) and standard deviation for a set of integer values entered by the user. Your program should o Prompt the user for the number of values, n. (n must be 1 or greater!) Output "You must enter an integer greater than 0" and reprompt the user if the number of values is not an integer value greater than 0. o Create an array to store the values. Prompt the user for each value and store it in the array. Output Invalid value and reprompt if the user enters something other than an integer. o Calculate and output the mean of the values with 2 decimal places. o Calculate and output the standard deviation of the values (with 2 decimal places) using the formula given below: N 1 = (X; - )2 i=1 Your program output must match what is shown in the program execution examples below: > java StatisticsCalculator How many values?: 4 Enter value 1: 4 Enter value 2: 5 Enter value 3: 8 Enter value 4: 9 Mean: 6.50 Standard Deviation: 2.06 > java StatisticsCalculator How many values?: You must enter an integer greater than a How many values?: abc You must enter an integer greater than How many values?: 3 Enter value 1: 8 Enter value 2: xyz Invalid value Enter value 2: hi Invalid value Enter value 2: 9 Enter value 3: 2.25 Invalid value Enter value 3: 2 Mean: 6.33 Standard Deviation: 3.09
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
