package cse1030.test2; import cse1030.drawing.Point2D; /** * A circle shape. Each circle is defined by its radius * and the position of its center point. The bounding box for * the circle is the square with length equal to twice * the radius. * * @author CSE1030_F13_14 * */ public class Circle extends Shape { /** * Create a circle of radius r and center point p. * * @param r the radius of the circle * @param p the center point of the circle */ public Circle(double r, Point2D p) { super(2. * r, 2. * r, p); } /** * Get the radius of the circle. * * @return the radius of the circle */ public double getRadius() { return 0.5 * this.getWidth(); } /** * Get the area of the circle. The area of the circle is * π * radius * radius * * @return the area of the circle * @see cse1030.test2.Shape#getArea() */ @Override public double getArea() { double r = 0.5 * this.getWidth(); return Math.PI * r * r; } }