Project 17: Rectangle Ratio
Suppose you had 30 feet of fencing that could form a rectangle and you wanted to construct a rectangle that produced the most space inside for your livestock. There are many ways you can form a rectangle with 30 feet.
Way 1: length = 10, width = 5 Area = 50 sq. feet
Way 2: length = 12, width = 3 Area = 36 sq. feet
Way 3: length = 8, width = 7 Area = 56 sq feet
All 3 of these examples use a perimeter of 30 feet but result in different area. One measure we can use to evaluate how efficient a rectangle is in terms of area and perimeter is by dividing the area by the perimeter.
Way 1: length = 10, width = 5 Area = 50 sq. feet Ratio = 1.667
Way 2: length = 12, width = 3 Area = 36 sq. feet Ratio = 1.2
Way 3: length = 8, width = 7 Area = 56 sq feet Ratio = 1.867
Project: Variables 'length' and 'width' have been initialized to the values below. Appropriately initialize the value of 'ratio' that represents the ratio of the area to perimeter as explained above.
Note: If your code works for 5 test cases in a row, you can enter your e-mail address.