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,

C:\Users\mchemudu\Downloads\H2 Spring 2019-ELET 4309 CPP FINAL.docxx, FA: 02/12/2019 Spring 2019, H2 - 1

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 : 53.6, -31.12, 66.22, 34.21 set 2 : -42.0, 34.0, -62.0, 32.0, -45.0 set 3 : -70.0 set 4 : 43.6, -21.5, -32.34, 46.9, 43.6, -12.54 set 5 : 0.0, 0.0, 0.0 set 6 : 6.2, 6.2, 6.2, 6.2 set 7 : -5.0, -5.0, -5.0, -5.0, -5.0 set 8 : 0.0

RULES: 18. Do not use and in this assignment and all other assignments. 19. Do not use any #define in your program until the time that is required for class declaration header files. 20. No goto statements allowed in any program that you develop in this course.

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

Records And Database Management

Authors: Jeffrey R Stewart Ed D, Judith S Greene, Judith A Hickey

4th Edition

0070614741, 9780070614741

More Books

Students also viewed these Databases questions