Question: Need help on problem p6.2 pleaseee Mean and standard deviation. Write a program that reads a set of floating-point data values. Choose an appropriate mechanism
Mean and standard deviation. Write a program that reads a set of floating-point data values. Choose an appropriate mechanism for prompting for the end of the data set. When all values have been read, print out the count of the values, the average, and the standard deviation. The average of a data set {x_1 ..., x_n} is x = sigma x_i, where sigma x_i = x_1 + ... + x_n is the sum of the input values. The standard deviation is s = Squareroot sigma(x_i - x)^2 - 1 However, this formula is not suitable for the task. By the time the program has computed x, the individual x_i are long gone. Until you know how to save these values, use the numerically less stable formula s = Squareroot sigma x_i^2 - 1 (sigma x_i)^2 - 1 You can compute this quantity by keeping track of the count, the sum, and the sum of squares as you process the input values. Your program should use a class DataSet. That class should have a method public void add(double value) and methods getAverage and getStandardDeviation
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
