package cse1030; import java.awt.Color; import princeton.introcs.StdDraw; /** * A circle shape. A circle has a radius that is always greater than zero. * * @author CSE1030Z * */ public class Circle extends Shape { /** * Create a circle with position (0, 0), color blue, and radius 1. */ public Circle() { // make sure to call the superclass constructor first } /** * Create a circle with position (x, y), and the given radius and color. * * @param x the x coordinate of the position of the circle * @param y the y coordinate of the position of the circe * @param radius the radius of the circle * @param color the color of the circle * @throws IllegalArgumentException if the radius is zero or negative */ public Circle(double x, double y, double radius, Color color) { // make sure to call the superclass constructor first } /** * Create a circle with the given position, radius, and color. * * @param position the position of the circle * @param radius the radius of the circle * @param color the color of the circle * @throws IllegalArgumentException if the radius is zero or negative */ public Circle(Point2D position, double radius, Color color) { // make sure to call the superclass constructor first } /** * Get the radius of the circle. * * @return the radius of the circle */ final public double getRadius() { } /** * Set the radius of the circle. The radius must be greater than zero. * * @param newRadius the new radius of the circle * @throws IllegalArgumentException if the radius is zero or negative */ final public void setRadius(double newRadius) { } /** * Returns a string representation of the circle. * *
* The string returned has the form: * *
* position: (x, y), color: (r, g, b), radius: R
where x
* and y
are the coordinates of the position,
* r
, g
, and b
are the
* red, green, and blue components of the color in the range 0-255,
* and R
is the radius.
*
*
* @return a string representation of the circle
*/
@Override
public String toString() {
}
/**
* Draws a filled circle to StdDraw
using the
* position, radius, and color of this circle.
*/
@Override
public void draw() {
// use StdDraw.setPenColor first
// then use StdDraw.filledCircle
}
}