Question: Program Requirements Name your program file stats.cpp Do not use any global variables (Links to an external site.)Links to an external site.. Use only iostream

Program Requirements

  1. Name your program file stats.cpp
  2. Do not use any global variables (Links to an external site.)Links to an external site..
  3. Use only iostream and iomanip functions for I/O and formatting (no stdio) - but may use other header files such as
  4. Your program will have four functions:
    1. main
    2. mean
    3. deviation
    4. histogram
  5. main
    1. Define a variable to mantain a count of the number of scores entered and initialize it to 0
    2. Define the scores array (the scores array does not need to be initialized)
    3. Allow for a maximum (not total) of 100 scores (see Arrays and Loops (Links to an external site.)Links to an external site. - the examples at the bottom of the page)
    4. Read a list of integers from the console one at a time and place each integer into the scores array
    5. None of the entered scores will be < 0
    6. Increment count for each score read and stored in the scores array
    7. Stop the data entry and begin the calculations when the user enters a -1 (do not include the -1 in the data)
    8. Call the histogram function (pass any arguments that are needed)
    9. Print the histogram (the histogram function fills and returns the bins array but you must print the histogram in main - see the "Test Cases" below for an example of the required output); this sub-problem is similar to drawing the trunk of the pine tree
    10. Call the deviation function, which returns the standard deviation
    11. Print the standard deviation (steps j and k may be combined into a single statement if desired)
  6. mean
    1. Pass in whatever arguments are needed - see average.cpp (Links to an external site.)Links to an external site.
    2. Return a double value that is the mean or average of the scores
  7. deviation
    1. Pass in whatever arguments you need
    2. Return a double that is the standard deviation of the scores
  8. histogram (the histogram function fills and returns the bins array - it does NOT print the histogram)
    1. Calculate the histogram (i.e., fill but do not print the bins array)
    2. Returning an array from a function presents a special problem. The text presents the problem and three possible solutions. Choose and implement one of the three techniques illustrated in Arrays And Functions (Links to an external site.)Links to an external site..
    3. Each element in the bins array is really an accumulator and so must be initialized to 0. See Figure 2 (Links to an external site.)Links to an external site. for an example.
    4. Group the scores in the histogram as follows
      Bin 9: score  90 Bin 8: score  80 but < 90 Bin 7: score  70 but < 80 . . . Bin 1: score  10 but < 20 Bin 0: score < 10
    5. Note that some scores in the input include extra credit (i.e., are > 100); your program must work for scores up to 109.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!