Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Develop a flowchart and then write a menu-driven C++ program that uses several u

ID: 3759818 • Letter: D

Question


Develop a flowchart and then write a menu-driven C++ program that uses several user-defined FUNCTIONS and ONE-DIMENSIONAL ARRAYS as specified

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

   Help                        Largest                        Quit

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. Once the user's input is processed, the screen will be cleared and the menu is displayed again.

Your program will declare an array of type double and DIM 60 in the main function. The user will determine the actual number of elements to be used when prompted.

L or l ( for Largest ) option will invoke the function largest( ) and passes the uninitialized array of 60 elements to this function with the DIM. Inside the function largest(), the function sizeOfArray( ) is called and the user is prompted for the actual number of elements to be used for the array. The function sizeOfArray() must check to make sure the actual size of the array does not exceed 60. If the user inputs an out of range number, the function must generate an error message and request a number in the range again. Once an acceptable size is inputted, the value is returned to the function largest() via the return statement. The function largest() will then invokes the function initMyArray() and passes the array information (the array with the actual size). Inside the function initMyArray(), the function prompts the user for your last name’s initial and uses the decimal equivalent of the initial together with the random number generation facility (as shown in the example discussed in the class) to generate and initialize the array using a looping construct. Once the array is initialized and the control is back to the function largest(), the function invokes the function findMax(), where the maximum number in the array is found and returned, via the return statement. The function largest() then calls the function displayAll(), where the array and the largest number in the array are displayed using the format shown below. The format shown below is for four elements array. Your array will be different.

 a[0] = xxxx.xx

 a[1] = xxxx.xx 

 a[2] = xxxx.xx

 a[3] = xxxx.xx 

 Largest no. =  xxxx.xx         

Note that two digits after the decimal point is specified.

The results should stay on the screen with the following prompt which will appear on the LOWER RIGHT CORNER of the screen:

             Strike any key to continue...

Once the user entered a key, the screen will be cleared and the menu is displayed again.

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

Notes:(please read very carefully)

1. Make sure your media is VIRUS FREE!

2. Comment your program. Good commenting is always required.

3. Use meaningful prompts.

4. Provide a brief description of the problem being solved.

5. Be sure to include a header file at the beginning of your program as shown in the course syllabus.

6. NO global declarations of VARIABLES allowed in any program that you develop in this course.

11. Illegal inputs must be handled properly without terminating the program

14. Your program will work for any set of numbers.

15. Use Microsoft Visual C++ .NET 2010 compiler using default compiler settings.

16. Adherence to the ANSI C++  required.

17. Do not use <stdio.h> and <conio.h>  in this assignment and all other assignments.

18. Do not use any #define in your program until the time that is required for class declaration header files.

19. No goto statements allowed in any program that you develop in this course.

Explanation / Answer

a[0] = xxxx.xx
a[1] = xxxx.xx
a[2] = xxxx.xx
a[3] = xxxx.xx
Largest no. = xxxx.xx   
Note that two digits after the decimal point is specified.
The results should stay on the screen with the following prompt which will appear on the LOWER RIGHT CORNER of the screen:
Strike any key to continue..