The complete method is in the revised class definition, below.
The class is now well enough defined to do some testing.
Since it is expected to be used with an applet,
a testing applet must be written.
Here is the current version of the Circle
class,
with a testing applet:
import java.applet.Applet; import java.awt.*; class Circle { // variables int x, y, radius; // constructors public Circle() { x = 0; y = 0; radius = 0; } public Circle( int x, int y, int radius ) { this.x = x; this.y = y; this.radius = radius; } // methods void draw( Graphics gr ) { int ulX = x-radius ; // X of upper left corner of rectangle int ulY = y-radius ; // Y of upper left corner of rectangle gr.drawOval( ulX, ulY, 2*radius, 2*radius ); } } // assume that the drawing area is 200 by 200 public class testCircle extends Applet { Circle circ = _____________________________; public void paint ( Graphics gr ) { circ.draw( _____________ ); } }