Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Telford
- * September 14, 2017
- * Circle class
- */
- public class Circle {
- private double radius;
- public Circle() {
- radius =1;
- }
- public Circle(double r) {
- radius = r;
- }
- public double getArea() {
- return radius * radius * Math.PI;
- }
- public double getPerimeter() {
- return 2 * Math.PI * radius;
- }
- public String toString(){
- return "The area and perimeter of this circle is " + getArea() + " " + getPerimeter();
- }
- public void setRadius(double newRadius) {
- radius = newRadius;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment