C++ Write a program that displays the follow menu: Geometry Calculator    1. Calculate the Area of a...

90.2K

Verified Solution

Question

Programming

C++

Write a program that displays the follow 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 ofthe circle then display it's area using the following formula: area= PIr2 Use 3,14159 for PI and the radius of the circlefor r. If the user enters 2, the program should ask for the lengthand width of the rectangle, then display the rectangle's area. Usethe following formula: area = length * width

If the user enters 3, the program should ask for the length ofthe triangle's base and it's height, the display its area. Use thefollow formula: area = base * height * .5

If the user enters 4, the program should end.

Input Validation: Display an error message if the user enters anumber outside the range of 1 through 4 when selecting an item fromthe menu. Do not accept negative values for the circle's radius,the rectangle's length or width, or the triangle's base orheight.  

You can use either if/then/else or the switch statement to buildyour menu.

For extra credit on this assignment, make each of the 3calculations function calls. This is not required to get fullpoints on the assignment, only if you would like extra credit andextra practice writing modular programs with functions.

Answer & Explanation Solved by verified expert
3.9 Ratings (406 Votes)
PROGRAMPlease find below the detailed commented program wit differentmodules to calculate the areas as per user choiceinclude to use cin and coutinclude to format the output with    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students