Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- *
- * @author Steve
- * version 1.0.1
- */
- public class Circle
- {
- public static final double DEFAULT_RADIUS = 8.8;
- public static final String DEFAULT_COLOR = "red";
- private double radius;
- private String color;
- public Circle()
- {
- radius = DEFAULT_RADIUS;
- color = DEFAULT_COLOR;
- }
- public Circle (double radius)
- {
- this.radius = radius;
- color = DEFAULT_COLOR;
- }
- 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 is " + color;
- }
- public double getArea()
- {
- return radius*radius*Math.PI;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement