Assignment: #stats1 |
Due: 10/07/02018 | Points: 5 |

This assignment requires you to make modifications to your #stats0 program.

## Dynamically Create a Fourth Data Set

Using the

malloc()function from the STDC Library, dynamically allocate memory to store a fourth data set (setd) that contains a copy of the contents of the three compiled data sets (seta, setb, setc).Similar to what was done for the other data sets, print the range, mean, median, mode, sum, and product for setd.

## Implement the Calculation of the Median and Mode

Data set sorting must be implemented using the

qsort()function from the STDC Library.## Searching

Implement a search loop that prompts the user to enter a search value. Search each of the four sets for the entered input. The output of this portion of the program should look like the following. Loop until the user enters 'n' in response to a confirmation prompt.

enter search value:n found in seta n not found in setb n found in setc n found in setd do you want to do another search (y or n): ## bool search(int* set, int nelems, int search_value)

Define a function that searches parameter

set(containingnelems) for parametersearch_value. Returntrueif found, else returnfalse.Searching must be implemented using the

bsearch()function from the STDC Library.## Example Output

Note: The sets are printed sorted from smallest-to-largest.

set A: { 5,10,15,20,25, } set A: range=20; mean=15; median=15; mode=modeless set A: sum=75 set A: product=375000 set B: { -2,-2,-2,-2,0,2,2,2, } set B: range=4; mean=-0.25; median=-1; mode=-2 set B: sum=-2 set B: product=0 set C: { -1,1,8,9,10,10, } set C: range=11; mean=6.16667; median=8.5; mode=10 set C: sum=37 set C: product=-7200 set D: { -2,-2,-2,-2,-1,0,1,2,2,2,5,8,9,10,10,10,15,20,25, } set D: range=27; mean=5.78947; median=2; mode=-2 set D: sum=110 set D: product=0