Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 void setRadius(double radius)
- {
- this.radius=radius;
- }
- public double getRadius()
- {
- return radius;
- }
- public void setColor(String color)
- {
- this.color = color;
- }
- public String getColor()
- {
- return color;
- }
- public String toString(int a)
- {
- return ("Circle " + a + " 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