-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShape.java
42 lines (32 loc) · 822 Bytes
/
Shape.java
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
41
42
package hw6.shape;
abstract public class Shape {
protected String color;
protected boolean filled;
public Shape() {
color = "red";
filled = true;
}
public Shape(String color, boolean filled) {
this.color = color;
this.filled = filled;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public boolean isFilled() {
return filled;
}
public void setFilled(boolean filled) {
this.filled = filled;
}
public abstract double getArea();
public abstract double getPerimeter();
@Override
public String toString() {
return String.format("Shape[color=%s,filled=%s]"
, color, filled ? "true" : "false");
}
}