Question: Code the following problem. Comment the code properly, indent and use blank lines to make it easy to read. Hand in the code and output.

Code the following problem. Comment the code properly, indent and use blank lines to make it easy to read. Hand in the code and output.

Verify your code by checking your answer against results from using a calculator or by hand.

1. Your program will ask the user to enter, via the console, the length and width of a rectangle and assign those values to double variables length and width

2. Compute the perimeter (twice the width plus twice the length) and the area (length times width). Stores those values into double variables named perimeter and area

3. Print the value of width and length that you read in followed by the perimeter and area you computed. For example, the output might be,

A rectangle with width 8.75 and length 10.2 has area of 89.25 and perimeter 37.9

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!