# Question: You will create, implement and test a small class called statistician, which is similar to some of the small classes in Chapter 2 of the text. – Free Chegg Question Answer

You will create, implement and test a small class called statistician, which is similar to some of the small classes in Chapter 2 of the text.

.

The new class is called statistician, using a header file, stats.h (attached),(most of which is written for you) and an implementation file, stats.cpp (which you need to create and implement.). The statistician is a class that is designed to keep track of simple statistics about a sequence of real numbers. There are two member functions that you should understand at an informal level before you proceed any further. The prototypes for these two functions are shown here as part of the statistician class declaration:

`   class statistician`
`   {`
`   public:`
`       ...`
`       void next(double r);`
`       double mean( ) const;`
`       ...`
`   };`

The member function “next” is used to give a sequence of numbers to the statistician one at a time. The member function “mean” is a constant member function that returns the arithmetic mean (i.e., the average) of all the numbers that have been given to the statistician.

Example: Suppose that you want a statistician to compute the mean of the sequence 1.1, 2.8, -0.9. Then you could write these statements:

`   // Declares a statistician object called s`
`   statistician s; `
`// Give the three numbers 1.1, 2.8 and -0.9 to the statistician`
`   s.next(1.1);`
`   s.next(2.8);`
`   s.next(-0.9);`
`// Call the mean function, and print the result followed by a carriage return`
`   cout << s.mean( ) << endl;`

The output statement will print 1.0, since 1.0 is the mean of the three numbers 1.1, 2.8 and -0.9.

Once you understand the workings of the next and mean member functions, you can look at the complete specification of the statistician class, which is in the file `stats.h`.  Notice that the statistician class in this file is part of a namespace called `CISP430_A1`.  You should use this namespace for your statistician. In this file you will find a precondition/postcondition contract for all the statistician’s member functions, including:

`Transcribed text From Image: `

`Answer:`