Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!