Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In C++ The name of the file must be stats.cpp. Write a program that implements the following statistical analysis functions as defined below. In your
In C++ The name of the file must be stats.cpp. Write a program that implements the following statistical analysis functions as defined below. In your moin) function: -Ask the user to enter the number of values to be processed -Dynamically allocate an array of integers based on the users input -Allow the user to enter the values and store them in the array -Create a menu that enables the user to choose the statistical function Based on the user's choice, one of these functions will be called and the result will be displayed: a) getAveragefint arr, int size): this function returns the average of the numbers in the array pointed to by arr orr is a pointer to an array passed as an argument and size is the length of the array. b) getMedianfint "arr, int size): this function returns the median. You need to have the array sorted in order to get a valid median value. See the submitted version requirements for more details. c) getlargestfint "arr, int size): this function returns the highest value in the array pointed to by arr. d) getSecondLargestfint "arr, int sizeJ: this function returns the second largest value in the array pointed to by arr Coding requirements for submitted file: -Validate all user inputs using loops Allow the user to choose when to end the program by adding something like "Enter XX to Quit option to your menu -Call a sorting function from getMedian function to be able to calculate the median Sample run: Enter nunber of values to be processed: Invalid Input! Please enter a value 0: 5 Please enter the values:4 7 42 30 19 Enter choice: 1. Average 2. Median 3. Largest 4. Second Largest 5. To Quit The average is: 20.4 Enter choice: 1. Average 2. Median 3. Largest 4. Second Largest 5. To Quit The nedian is: 19 Enter choice: 1. Average 2. Median. 3. Largest 4. Second Largest 5. To Quit Invalid Choice! Please enter your choice: 5
In C++
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started