-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCircle.java
More file actions
50 lines (40 loc) · 889 Bytes
/
Copy pathCircle.java
File metadata and controls
50 lines (40 loc) · 889 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
41
42
43
44
45
46
47
48
49
50
public class Circle {
private double radius;
private String color;
private final double PI = 3.14;
public Circle()
{
radius = 1.0;
color = "red";
}
public Circle(double radius)
{
this.radius=radius;
color="red";
}
public Circle(double radius,String color)
{
this.radius=radius;
this.color=color;
}
public double getRadius() {
return radius;
}
public void setRadius(double radius) {
this.radius = radius;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public double getArea()
{
return PI*radius*radius;
}
@Override
public String toString() {
return "Circle [PI=" + PI + ", color=" + color + ", radius=" + radius + "]";
}
}