Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using C++ on Virtual Studio 2017 write a program that displays the following menu: Geometry Calculator 1. Calculate the area of a Circle 2. Calculate

Using C++ on Virtual Studio 2017 write a program that displays the following menu:

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

If the user enters 1, the program should ask for the radius of the circle and display its area. Use the following formula: area = pi times radius squared. Use 3.14159 for pi.

If the user enters 2, the program should ask for the length and width of the rectangle and display the area. Use the formula area = length times width.

If the user enters 3, the program should ask for the length of the triangles base and its height. Display the area. Use the formula area = base times height times 0.5.

If the user enters 4 the program should end.

selection of choices 1 through 4 must use a switch case.

Input Validation: Display an error message if the user enters a number outside the range of 1 through 4. Do not accept negative values for any of the inputs.

Please use doubles as input for the measurements

The code must allow for looping for selections, wrong selections and validating input.

Your selection of choices 1 through 4 must use a switch case.

Must not allow values below zero for circle, rectangle or triangle inputs.

MUST USE THE FOLLOWING PROTOTYPES IN THE CODE:

//Prototypes

int displayMenu(); //displays menu and returns validated selection

double calcAreaCircle( double radius ); //returns the area of the circle, validate input

double calcAreaRect( double length, double width ); //returns the area of a rectangle, validate input

double calcAreaTriangle( double base, double height ); //returns the area of a triangle, validate input

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

Step: 3

blur-text-image

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

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

9th Edition

B01JXPZ7AK, 9780805360479

More Books

Students also viewed these Databases questions

Question

Velocity equal to the reciprocal of the distance, y(1) = 1

Answered: 1 week ago

Question

List the different categories of international employees. page 642

Answered: 1 week ago

Question

Explain the legal environments impact on labor relations. page 590

Answered: 1 week ago