Write a new static method to allow you to add two statisticians from the previous project. If

Question:

Write a new static method to allow you to “add” two statisticians from the previous project. If s1 and s2 are two statisticians, then the result of adding them 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.


Data from Previous Project

Specify, design, and implement a class called Statistician. 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 method called nextNumber. 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 = new Statistician( );

s.nextNumber(1.1);

s.nextNumber(-2.4);

s.nextNumber(0.8);

After a sequence has been given to a statistician, there are various methods to obtain information about the sequence. Include methods 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 (i.e., 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.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: