Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Develop a program flowchart and then write a menu-driven C++ program that will solve the following problem. The menu is shown below. Note: the letters

Develop a program flowchart and then write a menu-driven C++ program that will solve the following problem. The menu is shown below. Note: the letters shown as bold are for emphasis and you do not have to make them bold in your program. The program uses arrays, references, pointers, and functions to accomplish the tasks outlined below.

Help InputData Minimum maXimum miNmax Quit

Upon program execution, the screen will be cleared and the menu shown above will appear at the top of the screen and properly centered. The menu items are explained below.

H or h ( for Help ) option will invoke a function named help() which will display a help screen. The help screen(s) should guide the user how to interact with the program, type of data to be entered, and what results would the program produce. Each help screen should remain on the monitor until the user strikes any key (e.g., strike the space bar followed by a carriage return). Once the user strikes a key, the screen will be cleared and the menu is displayed again. Restrictions on the options M, m, X, x, N, and n would be mentioned here.

I or i ( for InputData ) option will prompt the user for the number of inputs to be tested. The program uses this number to fill a double array declared to store up to 35 elements. This option must be executed before options M, X, and N. A boolean flags are to be used here. See data to be used later on this assignment.

M or m ( for Minimum ) option will compute and display the minimum and frequency of occurrences of this minimum on the screen. This option implements the following two function prototypes:

Double~& minfunc(double& d1, double& d2);

void frequency(double& d1, short& freq);

The function minfunc() will receive two references, representing two data items, and returns a reference to the minimum to the calling function. Function frequency() will compute the frequency of occurrences for the minimum number in a data set. This function may be called from within minfunc() function. Once the user viewed the results, striking any key will clear the screen followed by the menu display. This option must be executed after option I or i.

X or x ( for maXimum ) option will compute and display the maximum and frequency of occurrences of this maximum on the screen. This option implements the following two function prototypes:

double& maxfunc( double& d1, double& d2);

void frequency( double& d1, short& freq);// this is the same as above

The function maxfunc() will receive two references, representing two data items, and returns a reference to the maximum to the calling function. Function frequency() will compute the frequency of occurrences for the maximum number in a data set. This function may be called from within maxfunc() function. Once the user viewed the results, striking any key will clear the screen followed by the menu display. This option must be executed after option I or i.

N or n ( for miNmax ) option will compute and display the minimum, the maximum, and their frequencies of occurrences. This option uses the functions mentioned above and the following function prototype:

void minmax( double* minv, short* minFreq, double* maxv, short* maxFreq);

the function minmax() receives values calculated before and processes them accordingly. The minimum value, the maximum value, and their frequencies of occurrences are displayed on the monitor. Once the user viewed the results, striking any key will clear the screen followed by the menu display. This option must be executed after options M and X. Again, you need to have mechanism in place so that this condition is met.

Q or q (for Quit) option will clear the screen and returns the control to the Visual Studio IDE.

Sample Data to be used is shown below. Of course, your program will work with any set of numbers within the specified range of elements.

Test your program with the following data sets and make sure your sample runs include them. Your program uses 2 digits after the decimal point when displayed.

set 1 : 43.6.5, -12.31, 54.11, 22.21

set 2 : -35.0, 43.0, -26.0, 51.0, -35.0

set 3 : -50.0

set 4 : 36.4, -12.5, -22.43, 64.8, 36.4, -22.43

set 5 : 0.0, 0.0, 0.0

set 6 : 4.2, 4.2, 4.2, 4.2

set 7 : -10.0, -10.0, -10.0, -10.0, -10.0

set 8 : 0.0

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

Computer Aided Database Design

Authors: Antonio Albano, Valeria De Antonellis, A. Di Leva

1st Edition

0444877355, 978-0444877352

More Books

Students also viewed these Databases questions