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

  Reduction polynomial on the computation

What is the influence of the choice of the reduction polynomial on the computation?

  Write a c program to print permutation

Given integer n and permutation of numbers 1,2,..n-1, c program to print permutation that lexicograghically precedes given input permutation if permutation is least print input permutation itself

  Dynamically allocates an array large enough

Write a program that dynamically allocates an array large enough to hold a number of test score. The size of the array should be input by the user

  Problem related to c programming

write a Grade Book program for his class to help him compute final grades. Design a program that asks for the student's name and four test grades. You are to display the student's name, four test grades, the average of the four test grades and the..

  Define a class that consists of three objects

Define a class that consists of three objects: day, month, and year. Within this class define two member function (constructor ) to initialize the objects to today?s date and one that display the date as follows: 05/7/2002

  Prompts the user to enter an integer

Write the code that prompts the user to enter an integer between 1 and 20 (including 1 and 20), reads the value using cin, and then prints the value that they entered in a statement that begins with "You entered a ". Save this version in a separate l..

  Calculate the modified value of the first character of input

To calculate the modified value of the first character of input we add its mapped value to the mapped value from the first character of the encryption string.

  Define a static method samecolor in the car class

Write an abstract class Car to implement the Comparable interface. Write a Truck class and a Sedan class to implement Car. define a static method sameColor in the Car class to find out weather a Truck and a Sedan has the same color.

  You have in your program an arraylist which includes

you have in your program an arraylist that contains employee salaries double type in arbitrary order. you need to

  Write c program which compute acceleration of jet fighter

Write a C++ program which compute the acceleration (m/s 2) of jet fighter launched from aircraft-carrier based catapult, provided jet's takeoff speed in km/hr

  Generic binary tree using java generics

In this project you will create a generic binary tree using Java Generics.

  Explain how priority queue list works

Hi. I have done a priority queue list. We have been giving test code to test our list. I will post what I have along with the issues. I keep getting an error with the getelement() part in the main program where we are supposed to print out the ele..

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