Question: C++: Implement the class statician below that stores the necessary information about a sequence of numbers, but not the actual numbers in the sequence. /*

C++: Implement the class statician below that stores the necessary information about a sequence of numbers, but not the actual numbers in the sequence.

/* Lab 1: Implement the class statician below that stores the necessary information about a sequence of numbers, but not the actual numbers in the sequence. After a statician object is initialized it can be given a sequence of double numbers. Each number in the sequence is given to the statistican by activating a member function called next-number. e.g. statistician s1; s1.next_number(98.6); s1.next_number(99.0); s1.next_number(98.2); etc. Be sure to write a main program that tests all of the class member functions and displays changes in statistician objects. */ // FILE: stats.cpp // CLASS PROVIDED: statistician // (a class to keep track of statistics on a sequence of real numbers) // // CONSTRUCTOR for the statistician class: // statistician( ); // Postcondition: The object has been initialized, and is ready to accept // a sequence of numbers. Various statistics will be calculated about the // sequence. // // PUBLIC member functions for the statistician class: // void next(double r) // The number r has been given to the statistician as the next number in // its sequence of numbers. // void reset( ); // Postcondition: The statistician has been cleared, as if no numbers had // yet been given to it. // int length( ) // Postcondition: The return value is the length of the sequence that has // been given to the statistician (i.e., the number of times that the // next(r) function has been activated). // double sum( ) // Postcondition: The return value is the sum of all the numbers in the // statistician's sequence. // double mean( ) // Precondition: length( ) > 0 // Postcondition: The return value is the arithmetic mean (i.e., the // average of all the numbers in the statistician's sequence). // double minimum( ) // Precondition: length( ) > 0 // Postcondition: The return value is the tinyest number in the // statistician's sequence. // double maximum( ) // Precondition: length( ) > 0 // Postcondition: The return value is the largest number in the // statistician's sequence. // // VALUE SEMANTICS for the statistician class: // Assignments and the copy constructor may be used with statistician objects. #include  class statistician { public: statistician( ); void next(double r); void reset( ); int length( ); double sum( ); double mean( ); double minimum( ); double maximum( ); int count; // How many numbers in the sequence double total; // The sum of all the numbers in the sequence double tinyest; // The smallest number in the sequence double largest; // The largest number in the sequence }; 

Please note:

The answer of this question must include all the necessary information needed for me to understand what is going on. It must have no syntax errors and must compile correctly with no errors. Please use commewnts as much as possible to help me understand it better. Thanks!

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!