question: public void square ( double x , double y , double r ) { if ( r < 0 ) throw new IllegalArgumentException ( "square side length can't be negative" ) ; double xs = scaleX ( x ) ; double ys = scaleY ( y ) ; double ws = factorX ( 2 * r ) ; double hs = factorY ( 2 * r ) ; if ( ws <= 1 && hs <= 1 ) pixel ( x , y ) ; else offscreen . draw ( new Rectangle2D . Double ( xs - ws / 2 , ys - hs / 2 , ws , hs ) ) ; draw ( ) ; }
target:  Draws a square of side length 2r, centered on (x, y).