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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started