import java.awt.Point;

public class SquarePoints implements PointGenerator {
    /** half-length of square side */
    private int r;
    
    /** center of star */
    private int x;

    /** center of star */
    private int y;

    /** constructor */
    public SquarePoints(int r, int x, int y) {
        this.r = r;
        this.x = x;
        this.y = y;
    }

    /** fulfill the PointGenerator contract */
    public Point[] getPointArray() {
        Point[] result = new Point[5];
        result[0] = new Point(x-r,y-r);
        result[1] = new Point(x+r,y-r);
        result[2] = new Point(x+r,y+r);
        result[3] = new Point(x-r,y+r);
        result[4] = new Point(x-r,y-r);
        return result;
    }
}
