Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Design and implement a class called statistician. After a statistician is initialized, it can be given a sequence of double numbers by invoking a member

Design and implement a class called statistician. After a statistician is initialized, it can be given a sequence of double numbers by invoking a member function next. For example, we can declare a statistician called s, and then give it the sequence of numbers 1.1, -2.4, 0.8 as shown here: statistician s; s.next(1.1); s.next(-2.4); s.next(0.8); After a sequence has been given to a statistician, there are various member functions to obtain information about the sequence. Include member functions that will provide the length of the sequence, the sum of all the numbers in the sequence, the arithmetic mean of the numbers, the smallest number in the sequence, and the largest number in the sequence. Notice that the length and sum functions can be called at any time, even if there are no numbers in the sequence. In this case of an empty sequence, both length and sum will be zero. But the other member functions all have a precondition requiring that the sequence is non-empty. Please implement stats.cpp given the following stats.h header file

#ifndef STATS_H #define STATS_H class statistician { public: // CONSTRUCTOR statistician( ); // MEMBER FUNCTIONS void next(double r); // CONSTANT MEMBER FUNCTIONS int length( ) const { return count; } double sum( ) const { return total; } double mean( ) const; double minimum( ) const; double maximum( ) const; private: int count; // How many numbers in the sequence double total; // The sum of all the numbers in the sequence double tiniest; // The smallest number in the sequence double largest; // The largest number in the sequence }; } #endif

Please help. I haven't done a programming assignment in many quarters so I'm very rusty and having a hard time understanding where to start. Thanks!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 31st International Conference Dexa 2020 Bratislava Slovakia September 14 17 2020 Proceedings Part 1 Lncs 12391

Authors: Sven Hartmann ,Josef Kung ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

303059002X, 978-3030590024

More Books

Students also viewed these Databases questions

Question

Advance warning and an explanation for the layoff.

Answered: 1 week ago