Write a class called StatisticsCalculator that calculates the mean (average) and
ID: 3646174 • Letter: W
Question
Write a class called StatisticsCalculator that calculates the mean (average) and standard deviation for a set of integer values entered by the user.Assume all input values will be valid integers (you don't have to test for validity). Your program should:
prompt the user for the number of values, n. (n must be 2 or greater!, assume it will be)
create an array to store the values.
prompt the user for each value and store it in the array.
calculate and output the mean of the values (x?).
calculate and output the standard deviation of the values using the Sample Standard Deviation formula below:
https://statistics.laerd.com/statistical-guides/measures-of-spread-standard-deviation.php
Here is a sample execution of the program:
csc% 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.38
==============================================================
I have been receiving codes with errors. If you don't mind please leave your email address
so that I can contact you for correction if there are errors. I would love to give five-star rating if the problem is solved.
Explanation / Answer
import java.io.*; import java.lang.*; class StatisticsCalculator throws Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int i=0,size=0; float sum=0,mean=0,std_deviation=0; System.out.println("Enter number of values:"); i=Integer.parseInt(br.readLine()); int array[]=new int[i]; while(i>0) { System.out.println("Enter"+i+"value"); array[size++]=Integer.parseInt(br.readLine()); i--; } for(i=0;iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.