ArchitectAreaCalculator

An Architect company needs a program to calculate the area of different shapes (rectangles, triangles and circles) based on their dimensions given by the user. The program must first display a menu that allows the user to select a shape. The program must then allow the user to enter the dimension(s) of the chosen shape and compute the area. All dimensions should be real numbers (decimal numbers) and the calculated area should be displayed with 2 decimal digits. The output of your program must look like the sample output below.

For a rectangle, the program should ask for the width and the length, and calculate the area as width * length.
For a triangle, the program should ask for the height and the base and calculate the area as (height *base) /2.
For a circle, the program should ask for the radius and calculate the area as 𝜋 * radius2.

INPUT VALIDATION: All user input must be validated and the program should terminate in case of invalid input. When selecting a menu item, if the user’s input is not 1, 2, 3 or 4, the program should terminate with an error message. For room dimensions, only positive values should be accepted. If the user enters 0 or a negative value, the program should again terminate with an error message.

×
New Download