Question
Geometry Calculator 1. Calculate the area of a Circle 2. Calculate the area of a Rectangle 3. Calculate the area of a Triangle 4. Quit
Geometry Calculator 1. Calculate the area of a Circle 2. Calculate the area of a Rectangle 3. Calculate the area of a Triangle 4. Quit If the user enters 1, the program should ask for the radius of the circle and then display its area. If the user enters 2, the program should ask for the length and width of the rectangle and then display the rectangle's area. If the user enters 3 the program should ask for the length of the triangle's base and its height, and then display its area. If the user enters 4, the program should end.
Use an integer variable for the "choice" variable, constant integers for the menu numbers, and real variables for the geometry dimensions. Display an error message if the user enters a number outside the range of 1 through 4 when selecting an item from the menu.
Program output may include: Enter the circle's radius: Enter the rectangle's width: Enter the triangle's height: Program ending. The valid choices are 1 through 4. Run the program again and select one of those. Run the program again and enter only positive values. The area is
Using the following test data: 1 , 23.575
Your output should look like this: Geometry Calculator 1. Calculate the area of a Circle 2. Calculate the area of a Rectangle 3. Calculate the area of a Triangle 4. Quit Enter your choice (1-4): Enter the circle's radius: The area is 1746.03
This is C++ and let code can be works on visual studio 2017 please.
Use blank lines to separate the major parts of your main function. And show your output.
use "default" , "const int CIRCLE_CHOICE = 1" and "int choice" in code.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started