Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

What code is about Specify, design, and implement a class called Statistician .

ID: 3542004 • Letter: W

Question

What code is about

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);

Provide methods to obtain information about the sequence:

Explanation / Answer

Examining the stat variables that are calculated, I see that those calcultions can be done without storing the values you're not doing that right!

I think that you need an array list to store the numbers or, not as good, more sophisticated calcs.. Then each of the stat calcs just access this array list.

Here's how to update the average when a new number is added:

ave = (ave*count + num)/(count+1);
also, you need to increment count after this operation.

I think that you should store the numbers in an array list.

+add
If you know what the maximum number of input numbers is then you can use an array of doubles. That would make the coding easier.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote