/** A Circle using the Class Point */ public class Circle { private Point center; private double radius; // static final double PI = 3.14; private static final double PI = Math.PI; /** Default constructor */ public Circle() { center = new Point(); radius = 0; } /** Constructor */ public Circle(double x, double y, double radius) { center = new Point(x,y); this.radius=radius; } /** Constructor */ public Circle(Point center, double radius) { this.center = new Point(center); this.radius=radius; } /** Constructor with a center and a Point p on the perimeter*/ public Circle(Point center, Point p) { this.center = new Point(center); this.radius=center.distance(p); } /** Returns the radius of circle */ public double radius() { return (radius); } /** Returns the position of the center as a Point */ public Point position() { return center; } /** Calculates the area */ public double area() { return (radius*radius*PI); } /** Calculates the perimeter */ public double perimeter() { return (2*radius*PI); } /** Converts the Circle to a String */ public String toString() { return("Circle at " + position() + " with radius="+radius); } }