[Solved] SOLVED:Class Rectangle

$25

File Name: SOLVED:Class_Rectangle.zip
File Size: 207.24 KB

SKU: [Solved] SOLVED:Class Rectangle Category: Tag:
5/5 - (1 vote)

Class Rectangle : with length & width default to 1 , methods to calculate perimeter & area , set & get for length & width , set verifies floating pt number larger than 0.0 and less than 20.0 Sample Output: Rectangle 1: The length is : 1.000000 The width is : 1.000000 The perimeter is : 4.000000 The area is : 1.000000 Rectangle 2: The length is : 2.000000 The width is : 1.000000 The perimeter is : 6.000000 The area is : 2.000000 Rectangle 3: The length is : 2.000000 The width is : 2.000000 The perimeter is : 8.000000 The area is : 4.000000 Enter the length: .001 Enter the width: .001 Rectangle 4: The length is : 0.001000 The width is : 0.001000 The perimeter is : 0.004000 The area is : 0.000001 Do you want to test an invalid length (1 for yes, 2 for no): 2 Do you want to test an invalid width(1 for yes, 2 for no): 1 testing: Rectangle r6 = new Rectangle(2,0); Exception in thread main java.lang.IllegalArgumentException: Width must be greater than 0.0 and less than 20.0 at Rectangle.<init(Rectangle.java:36) at RectangleTest.main(RectangleTest.java:91)

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] SOLVED:Class Rectangle
$25