Menu

[solved]-Write Menu Driven Program Allow User Select Run Program One First 3 Chapters Cpt 234 Creat Q39018903

Write a menu-drivenprogram to allow the user to select and run a program from one ofthe first 3 chapters of CPT 234.

Create a function todisplay a menu of choices, and have the function return the choicemade by the user. Also create a void function to take the menuchoice and run the desired program. Invoke the menu function, andpass the menu choice to the 2nd function. Put the above functionsin a loop so that the menu will continue to display (and theprogram will continue to run) until the user selects -1 (or anynegative value). When the program ends, display “Good bye!”.

Create 3 otherfunctions for the 3 chapter programs – TipTaxTotal (Chapter 2),MinutesHoursDays (Chapter 3), and CaloriesBurned (Chapter 4). Eachof these functions will accept no arguments and will also returnnothing. Follow the prior program instructions for each of theseprograms.

The Chapter 3 programwill use a decision to validate that the number of seconds isgreater than 0, and if not the Chapter 3 program will display amessage, end, and return to the menu.

Menu choices that arepositive numbers (other than 2, 3, or 4) will do nothing, andreturn to the menu.

There are 2 blank linebefore the menu is re-displayed.

Example Run#1:

(boldtype is what is entered by the user)

Progs 2, 3, 4Menu
————————
2 – Tip, Tax, Total
3 – Minutes, Hours, Days
4 – Calories Burned

Enter a choice (-1 toquit): 2

Enter the amount ofthe bill: $50.00

Based on a bill of$50.00, the calculated amounts are:
Tip = $7.50
Tax = $3.50
Total = $61.00

Progs 2, 3, 4 Menu
————————
2 – Tip, Tax, Total
3 – Minutes, Hours, Days
4 – Calories Burned

Enter a choice (-1 toquit): 3

Enter the number ofseconds: 40000

The number of secondsyou entered, 40000, is 666.67 minutes.
The number of seconds you entered, 40000, is 11.11 hours.

Progs 2, 3, 4 Menu
————————
2 – Tip, Tax, Total
3 – Minutes, Hours, Days
4 – Calories Burned

Enter a choice (-1 toquit): 4

You burn 3.9 caloriesevery minute you run.
This shows how many calories you burn if you ran for ‘x’minutes.

Minutes Calories
——- ——–
Using a while loop
10 39.00
15 58.50
20 78.00
25 97.50
30 117.00

Using a do-whileloop
10 39.00
15 58.50
20 78.00
25 97.50
30 117.00

Using a for loop
10 39.00
15 58.50
20 78.00
25 97.50
30 117.00

Progs 2, 3, 4 Menu
————————
2 – Tip, Tax, Total
3 – Minutes, Hours, Days
4 – Calories Burned

Enter a choice (-1 toquit): 5

Progs 2, 3, 4 Menu
————————
2 – Tip, Tax, Total
3 – Minutes, Hours, Days
4 – Calories Burned

Enter a choice (-1 toquit): -1
Good bye!

Expert Answer


Answer to Write a menu-driven program to allow the user to select and run a program from one of the first 3 chapters of CPT 234. C… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *