A good answer might be:

The completed method is given below:

Three Circles Drawn with One Object

Access methods often are simple to write.

  // change the center of the circle to a new X and Y
  void setPosition( int newX, int newY )
  {
    x = newX ;
    y = newY ;
  }

  // chage the radius of the circle
  void setRadius( int newR )
  {
    radius = newR ;
  }

Here is a new test applet, that draws concentric circles in the center of the drawing area:

// assume that the drawing area is 200 by 200
public class Test1Circle extends Applet
{
  Circle circ = new Circle();
  
  public void paint ( Graphics gr )
  { 
    circ.setPosition( 100, 100 );

    circ.setRadius( 10 );
    circ.draw( gr );

    circ.setRadius( 20 );
    circ.draw( gr );

    circ.setRadius( 30 );
    circ.draw( gr );
  }
}

Here is what it draws:



This is the same picture as previously, but because of the increased "object-ness" of the program is (perhaps) easier to understand.

QUESTION 10:

Propose a way to draw 10 concentric circles.