Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

3) 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. using this part of the code i want write a c++ code that cab get the same output that is give down here

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

T Sql Fundamentals

Authors: Itzik Ben Gan

4th Edition

0138102104, 978-0138102104

More Books

Students also viewed these Databases questions