Ch 4 Program 2: Geometry Calculator

Learning Goal: I’m working on a c++ project and need the explanation and answer to help me learn.

Ch 4 Program 2 – GeometryCalculator

Please adhere to the Standards for Programming Assignments and the C++ Coding Guideline.

Submit the following:

ï‚· List of source code with comments to document

ï‚· Test output listed as comments at the end of your program

GeometryCalculator.cpp (15 pts)

Write a program that displays the following menu:

1. Calculate the area of a circle

2. Calculate the area of a rectangle

3. Calculate the area of a triangle

4. Quit

Prompt the user to enter a menu choice.

Then based on the user’s choice use a switch statement to do the following:

ï‚· If the user enters 1, then you should prompt for the radius of the circle and display its area. Use

3.14159 for PI.

ï‚· If the user enters 2, then prompt for the length and width of the rectangle, and then display the

rectangle’s area.

ï‚· If the user enters 3, then prompt for the base and height of the triangle, and then display its

area.

ï‚· If the user enters 4, the program should end.

Input validation:

Display an error message if the user enters a menu number outside the range of 1 through 4 and end

the program.

Only accept positive values for the circle’s radius, the rectangle’s length or width, or the triangle’s base

or height. Display an error message and end the program.

Test data: Your included output must show your program running with the following sequence.

Menu choice 1. Radius = 3.7

Menu choice 2. length = 5.5, width = 3.

Menu choice 4. Should quit program.

Menu choice 9. Should generate error message.

Menu choice 3. base = -6.2, height = 4. Should generate error message.

Example output:

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

Enter the circle’s radius: 3.7

The area is 43.0084

Thanks for using the Geometry Calculator!

Press any key to continue . . .CSC100AA and CIS162AA Chapter 4 : Making Decisions

Ch4 Program 2 – GeometryCalculator.doc pbaker page 1 of 2

Do you need help with this paper? 🏆 - Let us help you write it!

Why Choose Our Essay Writing Service?

  • ✅ Original writing: Our expert writers will write each paper from scratch, ensuring complete originality, zero plagiarism and AI free content.
  • ✅ Expert Writers: Our seasoned professionals are ready to deliver top-quality papers tailored to your needs.
  • ✅ Guaranteed Good Grades: Impress your professors with outstanding work.
  • ✅ Fast Turnaround: Need it urgently? We've got you covered!
  • ✅ 100% Confidentiality: Customer privacy is our number one priority. Your identity is anonymous to our writers.
🎓 Why wait? Let us help you succeed! Our Writers are waiting..

Get started

Starts at $9 /page

How our paper writing service works

It's very simple!

  • Fill out the order form

    Complete the order form by providing as much information as possible, and then click the submit button.

  • Choose writer

    Select your preferred writer for the project, or let us assign the best writer for you.

  • Add funds

    Allocate funds to your wallet. You can release these funds to the writer incrementally, after each section is completed and meets your expected quality.

  • Ready

    Download the finished work. Review the paper and request free edits if needed. Optionally, rate the writer and leave a review.