Some Statistical Analysis
Programming Assignment
Some Statistical Analysis
Write a program that will calculate and print the sum, mean, variance, and standard deviation of 7 numbers. The numbers must be input as data. This input data must also be printed by the program.
If your seven numbers input have been named A, B, C, D, E, F, G, then the variance may be computed as:
variance = [(A-mean)2 + (B-mean)2 + ... + (G-mean)2]/6
and the standard deviation is the square root of the variance. (Hint: If you can't figure out how to get the square root in C++ leave it out at first. You can always add to your program later, once it works without it.)
Run your program three times, using three different sets of data:
Run I: 12, 22, 34, 43, 45, 54, 99
Run II: 1.0, 1.5, 2.5, -9.3, 0, -1.0, 3.0
Run III: Any 7 numbers of your own choosing.
Sample interactive console window produced by running the program:
*** PERSONAL / COURSE / ASSIGNMENT HEADER INFORMATION ***
I will give you the sum, mean, and standard deviation of any seven numbers.
Type each number, followed by the enter key.
Number =?
12
Number =?
22
Number =?
34
Number =?
43
Number =?
45
Number =?
54
Number =?
99
You have entered the following:
12
22
34
43
45
54
99
The sum is 309
The mean is 44.1429
The variance is 789.1436
The standard deviation is 28.0917