Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment 8 - The Switch Statement Menu Driven Program Write a program that displays the following menu: Geometry Calculator Calculate the Area of a Circle

Assignment 8 - The Switch Statement Menu Driven Program Write a program that displays the following menu: Geometry Calculator Calculate the Area of a Circle Calculate the Circumference of a Circle Calculate the Area of a Rectangle Calculate the Circumference of a Rectangle Calculate the Area of a Triangle Quit Enter your choice (1-6);

If the user enters 1, the program should ask for the radius of the circle and then display its area. Use the following formula: AreaofCircle = r2 Use 3.14159 for and the radius of the circle for r. If the user enters 2, the program should ask for the radius of the circle and then display its circumference. Use the following formula: CircumferenceofCircle = 2 r Use 3.14159 for and the radius of the circle for r. If the user enters 3, the program should ask for the length and width of the rectangle and then displays the rectangles area. Use the following formula: AreaofRectangle = length * width It the user enters 4, the program should ask for the length and width of the rectangle and then display the rectangles circumference. Use the following formula:

CircumferenceofRectangle = 2 * (length + width) It the user enters 5, the program should ask for the length of the triangles base and it height, and then display the triangles area. Use the following formula:

AreaofTriangle = base * height * .5 It the user enters 6, the program should end.

Input Validation: Display an error message if the user enters a number outside the range of 1 through 6, when selecting an item from the menu. Do not accept negative values for the circles radium, the rectangles length or width, or the triangles base or height.

Run this program to test all the possible input combinations. in C++ please, thanks!

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_2

Step: 3

blur-text-image_3

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

Flash XML Applications Use AS2 And AS3 To Create Photo Galleries Menus And Databases

Authors: Joachim Schnier

1st Edition

0240809173, 978-0240809175

More Books

Students also viewed these Databases questions

Question

2. How will you handle the situation?

Answered: 1 week ago