For this assignment, write a program that will act as a geometry calculator. Sou
ID: 2975705 • Letter: F
Question
For this assignment, write a program that will act as a geometry calculator. Sound familiar? Modify program 2 so that it can handle more than one shape when it is run (this will be accomplished by adding a loop) and use a cascading decision statement to handle the various shapes and error checking. As with program 2, display a menu to the user: Geometry Calculator 1. Calculate the area of a circle 2. Calculate the area of a triangle 3. Calculate the area of a parallelogram 4. Calculate the area of a trapezoid 5. Calculate the area of an ellipse 6. Quit Enter your choice (1-6): and get their choice. Cascading Decision Statement The cascading decision statement should be used to handle the various shapes and do the error checking. The handling of options 1 and 2 (the circle and triangle) is the same as in program 3. For option 3, the program should prompt the user to enter the length of the base of a parallelogram and its height. Those values should then be used to calculate the area of a parallelogram using the formula: Area of a Parallelogram = base * height For option 4, the program should prompt the user for the length of the two bases (the two parallel sides) of the trapezoid (NOTE: 2 separate values) and its height. Those values should then be used to calculate the area of a trapezoid using the formula: Area of a Trapezoid = 1/2 * (length of base 1 + length of base 2) * height For option 5, the program should prompt the user for the length of the semi-major axis (this is half the length of the widest diameter of the ellipse) and the length of the semi-minor axis (this is half the length of the narrowest diameter of the ellipse) of the ellipse. Those values should then be used to calculate the area of an ellipse using the formula: Area of an Ellipse = ? * length of Semi-Major Axis * length of Semi-Minor Axis For anything other than 1 through 6, the program should display an error message. Loop The cascading decision statement should be placed inside of a loop so that more that the area of more than one shape can be calculated and displayed when the program is run. This loop should continue to execute as long as the user has not selected option 6 from the menu. As with program 2, if the user selects the option to quit (option 6 in this program), the program should display "Goodbye!" and then end. This should be placed outside of the loop.Explanation / Answer
short the question.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.