Background:
The
(population) standard deviation (the square root of the variance) measures how much the data set varies from the mean (average).
Given the numbers: 100, 90, 83, 72, their mean is 86.25 and the standard deviation is 10.21.
For 19, 79, 77, 54, their mean is 57.25 and the standard deviation is 24.17.
Assignment:
Design an algorithm that calculates the mean and (population) standard deviation for four numbers.
Implement your algorithm in a new project (within your existing CodeLite workspace).
Change the name of
main.cpp to
lab3B.cpp.
Change the code in
lab3B.cpp to declare four variables to hold 100, 90, 83 and 72.
Display and mean and standard deviation for these numbers.
Verify that different values yields correct results.
Examples
The following examples are correct execution. If the four variables have the following numbers: 100, 90, 83, 72, the output should be exactly as follows:
Given 100.00, 90.00, 83.00, 72.00, the mean is 86.25, and the standard deviation is 10.21
Changing the variables to: 26, 14, 53, 23 yields the following output:
Given 26.00, 14.00, 53.00, 23.00, the mean is 29.00, and the standard deviation is 14.54
After completing the program and testing the output for accuracy, make sure that you have a comment lines at the top of your file with your name, course and section, current date, and description.
Submission
Submit your source code using the
handin program. For
handin, for this lab, type the following in a terminal window exactly as it appears:
handin lab3B lab3B.cpp
To verify your submission, type the following in a terminal window:
handin lab3B
Rubric:
Points Item
------ --------------------------------------------------------------
10 Documentation
Header comment block at the beginning of each file with:
+ Your full name
+ Date(s) code was written
+ Description
Comments explaining the role of each variable and major section of code
40 Correctness
Program solves the assigned problem using methods described in program description
Program compiles without errors
Program executes without crashing
Program produces the correct output
------ --------------------------------------------------------------
50 Total