Problem Write a program called Shapes that offers the user the choice of doing one of the following…

Kindly click here to proceed with this order or request a similar one…..

Problem

Write a program called Shapes that offers the user the choice of doing one of the following calculations:

  • Calculate hypotenuse of a right triangle
  • Calculate area of a right triangle
  • Calculate perimeter of right triangle
  • Calculate area of a rectangle
  • Calculate perimeter of rectangle
  • Calculate length of diagonal of a rectangle
  • Calculate area of a square
  • Calculate perimeter of square
  • Calculate length of diagonal of a square

For triangle calculations the user will enter the lengths of the two shorter sides.

For rectangle calculations the user will enter the length and width.

For square calculations the user will enter the length of one side.

The program will ask for the user’s choice, get the necessary inputs, call a method and then display the answer to 3 decimal places. Each calculation must be done by calling one of the five methods below.

You must create exactly five methods as shown below and call one for each of the calculations:

Method Parameters
Hypotenuse of a right triangle Two shorter sides
Area of right triangle Two shorter sides
Perimeter of right triangle Two shorter sides
Area of rectangle Length and width
Perimeter of rectangle Length and width

Your program must validate all user choices and inputs and keep running until the user chooses to quit.

Turning in the Assignment

When you have finished, run your program once using the test data below:

Calculation Input 1 Input 2
Calculate hypotenuse of a right triangle 1.23 4.56
Calculate area of a right triangle 1.23 4.56
Calculate perimeter of right triangle 1.23 4.56
Calculate area of a rectangle 1.23 4.56
Calculate perimeter of rectangle 1.23 4.56
Calculate length of diagonal of a rectangle 1.23 4.56
Calculate area of a square 1.23
Calculate perimeter of square 1.23
Calculate length of diagonal of a square 1.23

Kindly click here to proceed with this order or request a similar one…..

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *