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)

Hand in the following:

a) Source code, a java file

b) Screenshots of all output scenarios.

** use printf

** add comments

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

Data And Information Quality Dimensions, Principles And Techniques

Authors: Carlo Batini, Monica Scannapieco

1st Edition

3319241060, 9783319241067

More Books

Students also viewed these Databases questions

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago