Answer:

The complete method is in the revised class definition, below.

Testing Applet

The class is now well enough defined to do some testing. We need to write an applet for testing. Here is the current version of the Circle class, with a testing applet:

import javax.swing.JApplet;
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 JApplet
{
  Circle circ = ;
  
  public void paint ( Graphics gr )
  { 
    circ.draw(  );    
  }
}

QUESTION 6:

Fill in the blanks with some reasonable values.