Advertisement
RazorBlade57

Circle

Feb 20th, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1. public class Circle {          
  2.  
  3.    private double radius;
  4.    private String color;
  5.    private String Rc;
  6.    
  7.    public Circle() {
  8.       radius = 1.0;
  9.       color = "blue";
  10.       this.Rc = radius + color;
  11.    }
  12.    
  13.    public Circle(double r, String c) {
  14.       radius = r;
  15.       color = c;
  16.       this.Rc = radius + color;
  17.    }
  18.  
  19.     public GetCircle() {
  20.       return Rc;
  21.    }
  22.  
  23.    public double getRadius() {
  24.      return radius;
  25.    }
  26.  
  27.    public double getArea() {
  28.       return radius*radius*Math.PI;
  29.    }
  30.  
  31.    public String toString() {
  32.    return "Circle: radius=" + radius + " color=" + color;
  33. }
  34.  
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement