Question: Code block, C++. Thanks;) 3460:209 Assignment 7-A Assignment7-A: The Stats Array The purpose of this assignment is to help gauge your skills in writing small



Code block, C++. Thanks;)
3460:209 Assignment 7-A Assignment7-A: The Stats Array The purpose of this assignment is to help gauge your skills in writing small programs that involve arrays. Please note that this assignment indicates precisely what your program should accomplish, without a precise indication of how the program works. Part of your assignment is designing the techniques of how the program works Grading This assignment will be graded automatically by running the program and comparing the output with the correct output Because of the automated grading, the output of your program must match the specification exactly. You must not add any extra features that will confuse the grader. For example, the program must not print directions to the user unless such directions are required by the specification PROGRAM SPECIFICATION The program is an interactive program that reads input from the keyboard. Several instructions (listed below) may be entered by the user. For each input, the program will give a short response printed to cout. Each response to cout is followed by a single endl Important: The program must not try to store all the numbers in a single big array. In fact it is outlawed by the CSI police that you have any array that is larger than 100 elements Instead, you should create a frequency array which has indexes from [0] to [99]. A location, such as frequency[i], tells you how many times the number i has occurred in the input. This frequency array should be initialized to all zeros, and each time a number is read, the program will add one to the corresponding array location. For example, frequency[42] begins at zero. When one 42 is read, frequency[42] is increased to one. If another 42 is read, frequency[42] is increased to two, and so on. All of the statistics that you need to calculate can be computed based on the frequency array (so that you don't need to store all those numbers separately) Input: The letter N followed by an integer in the range 0 to 99. The biggest possible input number is 99. The specification does not care what the program does for numbers that are outside of the legal range. Output: The word "OK". Input: The letter S Output: The output is the SUM of all the input numbers read so far. This output is 0 f there has not yet been any numbers read by the program Input: The letter A. Output: The output is the AVERAGE of all the input numbers read so far, calculated as a double number. For example, if there have been four input numbers 2, 2, 6 and 5, then the average is 3.75. If there has not yet been any input numbers, then the program should print the word "ERROR" instead of an average
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
