Question: Write a program to input exactly 15 doubles, then calculate the mean and the standard deviation for those numbers, then to output the mean and
Write a program to input exactly 15 doubles, then calculate the mean and the standard deviation for those numbers, then to output the mean and the standard deviation, then to output each number followed by its number of standard deviations from the mean.
To calculate the standard deviation,
Calculate the mean
Calculate the sum of the squares of the difference of each number from the mean.
Divide that by the number of elements (15).
Take the square root of that.
Enter a score: 67 Enter a score: 75 Enter a score: 80 Enter a score: 99 Enter a score: 50 Enter a score: 92 Enter a score: 83 Enter a score: 85 Enter a score: 87 Enter a score: 77 Enter a score: 72 Enter a score: 69 Enter a score: 55 Enter a score: 73 Enter a score: 76 The mean is 76.0 The standard deviation is 12.452576707921404 67.0 -0.72 75.0 -0.08 80.0 0.32 99.0 1.85 50.0 -2.09 92.0 1.28 83.0 0.56 85.0 0.72 87.0 0.88 77.0 0.08 72.0 -0.32 69.0 -0.56 55.0 -1.69 73.0 -0.24 76.0 0.00
What would be a good formula to use to calculate the standard deviation of an individual number and what way can the individual numbers be shown in the output
this is what i have so far
public static void main(String[] args) {
double sum = 0;
double mean=0;
double standardDeviation=0;
double newDeviation=0;
int num = 15;
Scanner sc = new Scanner(System.in);
int [] list = new int [num];
for (int i=0; i System.out.print("Enter a Score: "); list[i]=sc.nextInt(); mean+=list[i]; } mean/=list.length; System.out.println("The mean is: " + mean); for (int i=0; i sum+=(mean-list[i])*(mean-list[i]); } sum/=list.length; standardDeviation=Math.sqrt(sum); System.out.println("The Standard Deviation is " + standardDeviation); for (int i=0; i System.out.println(((list[i]-mean)/standardDeviation)); } } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
