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

  Computing the effective address

An instruction is stored at the location 300 along with its address field at the location 301. The address field has value 400. A processor register R1 consists of the number 200.

  Make a modularized body mass index

build a modularized Body Mass Index (BMI) Program which will calculate the BMI of a team player.

  Data planning and modelling– enterprise modelling

Write down the major differences between the two approaches to the data planning and modelling– enterprise modelling and the view integration?

  Give an example of an anomaly that is solved

Why are non-database approaches to data management impractical? How does the database solve these problems? Provide a specific example of an anomaly that is solved by a database.

  Classify and discuss compensation potentially

Classify and discuss compensation potentially.

  Give a description of the current system

The board has asked whether a new system should include a web presence for their constituents, but they are not familiar with the pros and cons and need your help on the part of a proposed solution.

  Program for converting infix expressions into postfix form

Write a program which will transform the infix expressions into the postfix form and then determine the resulting postfix expression.

  Compile and run the program until it works

Write down overloaded Java methods that return the difference of two parameters. Your methods should contain the logic to return the difference of the larger parameter.

  Microsoft windows 2000 has domains alpha, beta, and omega

Microsoft Windows 2000  has domains ALPHA, BETA, and OMEGA

  Write down the decimal equivalents for ieee floating point

Add the unsigned binary numbers then express the answer in decimal.

  How to write a class named dayofyear that gets an integer

How to write a class named DayOfYear that gets an integer Day 2 would be January 2 Day 32 would be February 1 Day 365 would be December 31

  Designing the class

Develop a test class with at least three unit tests for the program which translates a letter grade into the number grade. Letter grades are A, B, C, D, F, possibly followed by + or -.

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