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

  Create a bitoutputstream

Implement a class named BitOutputStream, as shown in Figure for writing bits to an output stream. The writeBit(charbit) method stores the bit in a byte variable. When you create a BitOutputStream, the byte is empty

  Function that accepts a pointer to a c-string

Write a function that accepts a pointer to a C-string as an argument and returns the number of words contained in the string. Also have it display the average number of letters in each word.

  Describe an example application of polymorphism

Provide and describe an example application of polymorphism that could be used in a program solution. List and describe the class relationships.

  Display a report showing the energy produced

Open the data file Energy.dat and read each column into an array - Display a report showing the energy produced and the percentage of the grand total energy for each of the 13 types of energy for a given year. Prompt the user to enter the year.

  Write a grade book program

Your English instructor, realizing you are a programmer, asks you to write a Grade Book program for his class to help him compute final grades

  Direct cost variance analysis

Problem 2: Direct Cost Variance Analysis  Ken Co. uses standard costing for accounting. Following is the standards for production of its only product:Direct material: 18 pounds at $25 per pound

  What is realistic rendering in computer graphic

Differentiate between pillar boxing and the letter boxing. What is realistic rendering in computer graphic. Discuss the approach used in realistic rendering.

  Pseudocode for constructing the reverse of an input string

For each position of the string starting at the end working backwards - Append the character at that position to the reverse of the string.

  Write a program that will read in 2 numbers per line

1.Write a program that will read in 2 numbers per line, and print the sum. You program should work for any number of lines of data.

  A series of one-digit non-negative numbers

Write a program that asks the user to enter a series of one-digit non-negative numbers

  Write a literal representing the long integer

Write a literal representing the long integer value twelve billion.

  That takes the time as six integer arguments

Write a C function seconds_since_jan1() that takes the time as six integer arguments (year, month, day, hour, minute, and second) and returns the number of seconds since the beginning of the year.

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