Plan and implement a class called statistician in c++

Assignment Help Computer Engineering
Reference no: EM1331324

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: EM1331324

Questions Cloud

Organic food to satisfy the growing demand : Will there be enough organic food to satisfy the growing demand?
Make the price of an item for each of the five days : The Last Stop Boutique is having a five-day sale. Each day, starting on Monday, price will drop 10% of the previous day's price. For example, if the original price of a product is $20.00, the sale price on Monday would be $18.00 (10% less than the..
Gabriela manufacturing must decide : Gabriela Manufacturing must decide whether to insource or outsource a new toxic-free miracle carpet cleaner that works with its Miracle Carpet Cleaning Machine.
Discussing the interdependence of cultural variable : Discuss the interdependence of cultural variables and their impact on communication across cultures.
Plan and implement a class called statistician in c++ : build 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.
Three assumptions of underlying pay for performance plans : Identify three assumptions of underlying pay for performance plans.
Explaining western-chinese business negotiations : Identify some of the cultural and political differences that would influence Western-Chinese business negotiations.
Make a modularized body mass index : build a modularized Body Mass Index (BMI) Program which will calculate the BMI of a team player.
Make functionwill add one to each element in array of size : Write down the following C++ routines using pointers only. Do not use any [] 's in your code.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Determining the counterexample

Determine a counterexample for following algorithm on the basis of greedy strategy: Choose the largest subset for cover, and then delete all its elements from the universal set.

  Entity-relationship diagrams

The process of starting with the world objects and modelling utilizing the entity-relationship diagrams is known to as a top-down process.

  Express the top five categories of problems

Compare the two different systems and present the findings in tabular format.

  Describe disparity between vulnerability, threat and control

Describe disparity between vulnerability, threat and control

  Algorithm to prepare a job applicant report

Develop an algorithm in order to prepare a job applicant report. Input consists of a series of records that contain the Social Security number or equivalent, last name, first name, middle initial, verbal test score, science test score, math test s..

  Configuring a database

Configuring a Database

  Data and record structures

Explain the data and record structures for the vertex ordering and vertex or edge colouring (or labelling) and a suitably the greedy graph search algorithm in order to solve each of the following problems in time bound indicated.

  Related to investment in stock group

Specify the minimum amount Trader must invest in each stock group in order to achieve the investment goal?

  Main differences between c and c++ languages

What are the major differences between C and C++ languages? What do you want to learn in a programming language, such as C, in order to use it effectively in problem solving.

  Find the disadvantages of low quality

What are the advantages of high quality and the disadvantages of low quality.

  Creating the method

Assume we wish to form a method for class BinaryTree which decides whether two trees have same structure. The header of the method could be as follows: public boolean isIsomorphic(BinaryTreeInterface otherTree).

  Recommend a removable storage backup

Managers want to be able to print schedules on any printer at any restaurant if traveling and in a motel with a laptop. Please explain what you would have to do to allow managers to do this and how they will reference the printer.

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