Skip to content

Instantly share code, notes, and snippets.

@katychuang
Created May 11, 2019 20:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save katychuang/1fa1e3752c5ea9c450917b4e679909ea to your computer and use it in GitHub Desktop.
Save katychuang/1fa1e3752c5ea9c450917b4e679909ea to your computer and use it in GitHub Desktop.
public class Circle {
private double radius;
public Circle(double radius) {
this.radius = radius;
}
public double getRadius() {
return radius;
}
public void setRadius(double radius) {
this.radius = radius;
}
private double calculateArea() {
return radius * radius * Math.PI;
}
public String toString() {
return "The area of the circle [radius = " + radius + "]: " + calculateArea();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment