Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Develop a flowchart and then write a menu-driven C++ program that uses selection and repetition constructs as needed, and several user-defined functions to solve the

Develop a flowchart and then write a menu-driven C++ program that uses selection and repetition constructs as needed, and several user-defined functions to solve the following problem. Upon execution of the program, the program displays a menu as shown below and the user is prompted to make a selection from the menu.

The menu options are shown below. Help MulDoubles SubIntegers Quit Once the menu item is selected and validated, the program will proceeds with processing that selection as explained below.

If the user selects h or H, a user-defined function help() will be invoked. The function displays a help screen for the user. The help should tell the user how the program operates and what is needed from the user and how to terminate the program. Once the user viewed the help screen, striking any key will clear the screen followed by display of the menu again in function main().

If the user selects m or M, the program invokes the function MulDoubles(). Inside function MulDoubles(), the user is prompted for two numbers of type double. The function computes the product and returns the result to the function main() where the operands and the product are displayed. If the two double numbers are 51.63 and 23.45, then the result is displayed as shown below.

The product of 51.63 * 23.45 = 1210.7235 Use appropriate formatting flags to show four digits after the decimal point.

Once the user viewed the result, striking any key will clear the screen followed by display of the menu again in function main(). If the user selects s, or S, the user is prompted for two numbers of type integer.

This option will then pass the two numbers to the function subIntegers() and the function computes the difference and returns the result to the function main() where the operands and the difference will be displayed.

If the two integer numbers are 20 and 10, then the result is displayed as shown below.

The difference of 20 - 10 = 10

Once the user viewed the result, striking any key will clear the screen followed by display of the menu again in function main(). If the user selects q or Q, the program invokes the function quit() where the following message is displayed and the program is then terminated. The program will be terminated in function main(). The program terminated per the user request Any other menu item must be flagged as an error and the user is warned to make another selection from the menu, and the menu is displayed again. The wrong choice should not terminate the program. Once the program begins execution, it will not terminate until the user inputs q or Q.

For data of type float, check your program with following sets of data: 32.5, 6.4 -82.36, 35.15 -23.33, -49.25 For data of type integer,

check your program with the following sets of data: -40, 20 -45, 82 31.6, -5.65

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

Oracle 10g SQL

Authors: Joan Casteel, Lannes Morris Murphy

1st Edition

141883629X, 9781418836290

More Books

Students also viewed these Databases questions