Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Circle
- {
- public static final double RADIUS_DEFAULT = 1.0;
- public static final String COLOR_DEFAULT = "red";
- private double radius;
- private String color;
- public Circle() {
- radius = RADIUS_DEFAULT;
- color = COLOR_DEFAULT;
- }
- public Circle(double radius) {
- this.radius = radius;
- color = COLOR_DEFAULT;
- }
- 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 String toString() {
- return "Circle with radius = " + radius + "and color of" + color;
- }
- public double getArea() {
- return radius*radius*Math.PI;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement