Design and implement a class called statistician in c++

Assignment Help C/C++ Programming
Reference no: EM13936784

Design and implement a class called statistician in C++. After a statistician is initialized, it can be given a sequence of double numbers. Each number in the sequence is given to the statistician by activating a member function called next_number.

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_number(1.1);
s.next_number(-2.4);
s.next_number(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 last number of the sequence,

- the sum of all the numbers in the sequence,

- the arithmetic mean of the numbers (that is, the sum of the numbers divided by the length of the sequence),

- 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 all the other member functions have a precondition requiring that the sequence is non-empty.

Also provide a member function that erases the sequence (so that the statistician can start afresh with a new sequence).

Overload the + operator to add two statisticians. If s1 and s2 are two statisticians, then the result of s1 + s2 should be a new statistician that behaves as if it had all of the numbers of s1 followed by all of the numbers of s2.

Do not try to store the entire sequence because we do not know how long this sequence will be. Instead, just store the necessary information about the sequence: What is the sequence length? What is the sum of the numbers in the sequence?

What are the last, smallest, and largest numbers? Each of these pieces of information can be stored in a private member variable that is updated whenever next_number is activated.

Reference no: EM13936784

Questions Cloud

Why would cancer cells express high levels of telomerase : The enzyme telomerase adds DNA to the ends of chromosomes. Why would cancer cells express high levels of telomerase?
Evaluation of plan effectiveness criteria : Evaluation of Plan Effectiveness Criteria - Would I be able to implement the interventions? If not, what barriers exist
Difficulty to get people take part in market research survey : It is becoming more and more difficult to get people to take part in market research surveys. What are the implications of this and what can market researchers do to encourage people to take part? - No more than a 1,000 words.
What are the mechanisms of dna repair : What is DNA repair? What are the mechanisms of DNA repair? What is DNA stability?
Design and implement a class called statistician in c++ : Design and implement a class called statistician in C++. After a statistician is initialized, it can be given a sequence of double numbers. Each number in the sequence is given to the statistician by activating a member function called next_number..
Program to calculate the records in database : The O-So-Good Chocolate Company produces different types of chocolates daily. They need a little summary report that shows how much of each chocolate type they produce for a given month. This way they can plan next month's production schedule.
Appropriate tertiary qualifications-equivalent combination : Appropriate tertiary qualifications or an equivalent combination of qualifications and relevant demonstrated experience undertaking data warehouse development and support activities.
What were the two most common perspectives of the history : How did European thinkers in the past centuries view the past of the Earth, life, and especially, the human species? What were the two most common perspectives of the history of the Earth in the 17th and 19th centuries
Conduct a literature review : Conduct a literature review of about 600 words about customer satisfaction, in particular at shows.  Propose a sampling plan to survey visitors at the show.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Program that is supposed to search message.txt and print out

I'm having trouble with a program that is supposed to search message.txt and print out the message. i will upload instructions. We must use functions, and we were not instructed on how to search char arrays for this purpose and I am lost. Your hel..

  Draw a flowchart for a program

Draw a flowchart for a program that allows the user to enter 20 names along with their ages and their Social Security Numbers in three parallel arrays.

  Write a program using above data file

Write a program using above data file (must prompt user for file names- input and output) to read in the critical path information and write reports.  Print reports (3 reports) to an output file as below:Print a project completion timetable that list..

  Takes n number of element from user

Write a C program which takes n number of element from user (where, n is specified by user) and stores data in an array. Then, this program displays the largest element of that array.

  Prototypes would work for the function called func

Consider the following: int anArray[3][5] =

  Digital filtering

Write a main code that reads filter coefficient data from the file filter.txt and creates a filter, reads an input float_seq from the file input.txt, filters the input float_seq using the filterand then writes the output float_seq to the file, output..

  Question rearding the software process models

Waterfall, V-shape, and Rapid Application Development (RAD) are among well-established software process models that have been used to develop software

  Display the array, the average and the number of days above

Write a program that stores the daily temperatures for the month of April in an array name dailytemp. Calculate the average temperature for the month and the count the number of days that the daily temperature was above the average.

  Construct vector and linked lists data structures

You will prepare sorted versions of the Linked Lists and Vector data structures developed in class

  Write a c program for a hcs12 micro controller that writes

Write a C program for a HCS12 microcontroller that writes the value, 0x78, to Memory Location VAR1 and then calls a delay function. The delay function should generate a delay of 0.25 milliseconds

  Write a program that creates an array of 200 random numbers

Write a program that creates an array of 200 random real numbers between 0 and 200.  Using the statistics library, calculate and output the following: mean, median, variance, standard deviation, maximum value, and minimum value.

  Creating a database design in visior

Use "Appendix A: Designing Databases with Visio Professional: A Tutorial," to help you complete Section 1: Visio Database Design. (Note: This tutorial focuses on the use of Microsoft Visio. Open source applications are not covered in Appendix A..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd