-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRectangleTest.java
More file actions
38 lines (32 loc) · 1.5 KB
/
RectangleTest.java
File metadata and controls
38 lines (32 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
* Date: 05-NOV-2019
* Programmer: Dan Hopp
* Description: Test the Rectangle class. Do:
• Create a Rectangle object called rectangle1 with width 4.0 and height
40.0.
• Display width, height, area, and perimeter of the rectangle1 object.
• Create a Rectangle object called rectangle2 with width 3.5 and height
35.9.
• Display width, height, area, and perimeter of the rectangle2 object.
*/
package lab7;
public class RectangleTest {
public static void main(String[] args){
//Create a Rectangle object called rectangle1 with width 4.0 and height
//40.0
Rectangle rectangle1 = new Rectangle(4.0, 40.0);
//Display width, height, area, and perimeter of the rectangle1 object
System.out.println("Rectangle 1 Width = " + rectangle1.width
+ ", Height = " + rectangle1.height + ", Area = "
+ rectangle1.getArea() + ", Perimeter = "
+ rectangle1.getPerimeter());
//Create a Rectangle object called rectangle2 with width 3.5 and height
//35.9
Rectangle rectangle2 = new Rectangle(3.5, 35.9);
//Display width, height, area, and perimeter of the rectangle2 object
System.out.println("Rectangle 2 Width = " + rectangle2.width
+ ", Height = " + rectangle2.height + ", Area = "
+ rectangle2.getArea() + ", Perimeter = "
+ rectangle2.getPerimeter());
}
}