HW #9 - List Statistics Class

Due Mon, Apr 2 at 3:30 PM

Your assignment is to design and implement a class called StatList, which will provide statistical information about a list of numbers. The class will be initialized as empty, then numbers will be added by calling the member function addnumber. There will also be member functions to provide the length of the sequence, the sum of all the numbers, the average, the smallest number in the sequence, and the largest number in the sequence. Also there should be a member function to erase the sequence.

Think about when the programmer using your class should be allowed to call each function. (We'll discuss this during recitation.)

Also discussed during recitation will be efficient ways to implement this class (for instance, it's silly to store the whole sequence; just keep track of the necessary information about the sequence).

Requirements

This class should be described and declared in a header file; the functions should be contained in an implementation file. Write a simple driver program (put the numbers 1 through 50 into your StatList and output information about them, or something like that).

A design document is not required (your code should be fully commented, particularly in the header file, which will serve that purpose). As always, printed copies of code and sample output, and an electronic copy of the executable, are required.