| |

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: 

Expert Chegg Question Answer:

free chegg question answer
Smart Teacher From Answerie.com
Answer:

Answer


PILE: stattest.cx An Iateractive teat pxogzan for the statiaticlan clasa Weltten by Michael Main ainêcolozado.edu, Au 2, 199
<img src="https://media.cheggcdn.com/media%2F1f1%2F1f1afa98-904d-484e-8aa7-a461fb5e3f1d%2Fphp2DePAa.png" alt="case 33.reset cout <c Reset activated for a <c choice <<.
media%2Fdbd%2Fdbdba719-f0d4-4c0d-915c-cc
media%2F905%2F905e11b0-8088-4244-9074-4e
return 62 int test21 Test progran for ainizun/aximus atatistieian functions Returns 7 i2 everything goes okays otherwise retU
media%2F512%2F512c69d8-9098-4f5b-9dea-5b
media%2Fa12%2Fa12f6db1-74bd-40af-958f-7d

Free Chegg Question Answer

Leave a Reply

Your email address will not be published. Required fields are marked *