Question: I have written a program for you to complete. This problem is not to be included with the menu. Simply print when I run the

I have written a program for you to complete. This problem is not to
be included with the menu. Simply print when I run the menu program that
it is included in another project. You are to write a program that outputs
the mean, median, and modes. Your task is to complete the function. This
will use structures to pass information from one function to the print function.
Stats *stat(const Array *array){
//Non-working stub to be completed by the student
cout<
Stats *stats=new Stats;
stats->mode=new Array;
stats->mode->size=0;
int nModes=0;
stats->mode->data=new int[nModes];
stats->modFreq=1;
stats->median=0;
return stats;
}
I have also supplied the expected outputs you can compare against in a
StatResults.txt file.
This gives 3 example outputs.
Original Array
0 1 2 3 4 5 6 7
The average of the array = 3.5
The median of the array = 3.5
The number of modes = 0
The max Frequency = 1
The mode set = {null}
Original Array
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
0
The average of the array = 4.35484
The median of the array = 4
The number of modes = 1
The max Frequency = 4
The mode set = {0}
Original Array
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8
The average of the array = 4.38462
The median of the array = 4
The number of modes = 9
The max Frequency = 4

The mode set = {0,1,2,3,4,5,6,7,8}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!