write a program that computes the average and standard deviation of four scores 1

Write a program that computes the average and standard deviation of four scores. The standard deviation is defined to be the square root of the average of the four values. Use two functions. One function to calculate the average, this function should be with Return Type “double”. Second Function should be to calculate standard deviation, this function should be with Return Type “void”. Allow the program to continue until the user tells the program he/she is finished.

average = (s1 + s2 + s3 + s4) / 4

The standard deviation is computed as

standard_deviation = sqrt( ( (s1 -average)2 + (s2 – average)2 + ( s3 – average)2 + (s4 – average)2 )/4 ).

SAMPLE OUTPUT

Enter four decimal numbers =>12.3 13.4 10.5 9.0
The average = 11.3
The standard deviation of these numbers = 1.68375
Please enter y to continue =>y

Enter four decimal numbers =>1 2 3 4
The average = 2.5
The standard deviation of these numbers = 1.11803
Please enter y to continue =>n

file type : cpp

  • Point Distribution:
  • -50 Does not compile
  • -5 Warnings
  • -5 No description multiple line comments (name, date, etc)
  • -5 No single line comments (logic, input, output, etc)
  • -10 Incorrect Standard Deviation
  • -10 Incorrect Average
  • -10 Does not use at least 2 programmer defined functions
  • -10 Does not match the Return Type constraints
  • -10 Does not continue calculations as long as user wishes
  • 0 replies

    Leave a Reply

    Want to join the discussion?
    Feel free to contribute!

    Leave a Reply

    Your email address will not be published.