Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program to calculate the area of four shapes (Rectangle, triangle, circle and square). The program to present the user with a menu where

Write a program to calculate the area of four shapes (Rectangle, triangle, circle and square).

The program to present the user with a menu where one of the shapes can be selected.

Based on the selection made, the user enters the proper input, the program validates the input

(i.e all entries must be greater than zero).

Once the input is entered and validated, the intended area is calculated and the entered information along with the area are displayed.

Area of the Square = Side ^2

Area of the Rectangle = Length * Width

Area of the Triangle = Base * Hight

Area of the Circle = PI * R^2

You MUST apply the following to your program:

1) A switch statement to present the selection menu
2) If statement to validate the input for (entries must be greater than 0)
image text in transcribed
apply the for loop to the switch statmnet program using increment and decrement ( 2 versions) to display the counter and the output

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

Informix Database Administrators Survival Guide

Authors: Joe Lumbley

1st Edition

0131243144, 978-0131243149

More Books

Students also viewed these Databases questions