Question: implement a simple program that asks the user for a width and a height, storing them as double values. Afterwards, you compute area and perimeter

implement a simple program that asks the user for a width and a height, storing them as double values. Afterwards, you compute area and perimeter as if the shape were a rectangle. Output the results. Then, you compute the area and perimeter as if the shape were a right triangle and you have been given the base and height. Output the results. Make sure that the output is formatted nicely. Create a project called Lab2. Add a class called Shapes. Complete the description of the program given above so that your output looks as close to the following sample output as possible. In this sample, the user entered 3 and 5, respectively.

Sample

Area and Perimeter Calculator Enter width: 3

Enter height: 5 If your shape is a rectangle, its area is 15.0

Its perimeter is 16.0 

If your shape is a triangle, its area is 7.5 If it is a right triangle, its perimeter is 8.0 + square root of 34.0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!