Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 1 (40 points As stated in Lab Activity 5 Part B The name of the file must be stats.cpp. Write a program that implements

image text in transcribed

Problem 1 (40 points As stated in Lab Activity 5 Part B The name of the file must be stats.cpp. Write a program that implements the following statistical analysis functions as defined below. In your main) function: Ask the user to enter the number of values to be processed Dynamically allocate an array of integers based on the user's 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 orr arr is a pointer to an array passedas anargument 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) gettargestfint "arr, int sizel: this function returns the highest value in the array pointed to by arr d) getSecondLargestfint "arr, int size): this function returns the second largest value in the array pointed to by orr Coding requirements for submitted file: Validaee 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 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 to be processed: 0 The average is: 28.4 Enter choice: 1. Average. 2. Median. 3. Largest 4. Second Largest 5. To Quit The median is: 19 Enter choice: 1. Average 2. Median. 3. Largest 4. Second Largest 5. To Quit Invalid Choice! Please enter choice: 5

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

More Books

Students also viewed these Databases questions