forked from angiejones/java-programming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRectangle.java
More file actions
40 lines (30 loc) · 720 Bytes
/
Copy pathRectangle.java
File metadata and controls
40 lines (30 loc) · 720 Bytes
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
39
40
package chapter9;
public class Rectangle {
protected double length;
protected double width;
protected double sides = 4;
public double getLength() {
return length;
}
public void setLength(double length) {
this.length = length;
}
public double getWidth() {
return width;
}
public void setWidth(double width) {
this.width = width;
}
public double getSides() {
return sides;
}
public void setSides(double sides) {
this.sides = sides;
}
public double calculatePerimeter(){
return (2 * length) + (2 * width);
}
public void print(){
System.out.println("I am a rectangle");
}
}