Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

implement a class called statistiscian. after it is initizalized itcan be given

ID: 3609183 • Letter: I

Question

implement a class called statistiscian. after it is initizalized itcan be given a sequence of double numbers. each number in thesequence is given to the statiscian by activating a member functioncalled next_number. for example we can decalre a statisticiancalled s. and then give it a sequence of numbers 1.1, 2.4, 0.8 asshown here

s.next_number(1.1)
and so on

write member functions that will provide the length of thesequence,last number of the sequence, sum of all the numbers in thesequence, average of the numbers in the sequence, smallest numberin the sequence, largest number in the sequence and a memberfunction that erases the sequence.

write member functions that will provide the bool is_empty whichreturns true if no number is processed and operator <<function which displays the complete state of the statistician


i have everything except bool is_empty and operator <<.Please help.

Explanation / Answer

...Whatlanguage? class Statistician { public: Statistician(); ~Statistician(); void next_number(double insertThis); int Length(); double LastNumber(); double Sum(); double Average(); double SmallestNumber(); double LargestNumber(); void EraseSequence(); private: double Numbers[], Smallest,Largest; int Size; }; next_number puts the next double into the array atsize, then increments size. Also it checks if it is the Smallest orLargest number by comparing to smallest and largest. If so, then itreplaces the value in the appropriate variable. Length returns Size. SmallestNumber and LargestNumber return the appropriatevariable. Sum loops through the array and adds every number. Average gets the Sum and divides by Size. EraseSequence deletes the array.