Circle Class

The circle class has to store all the relevant state and define the relevant behaviour for a circle object. A circle must know where it is...

Circle Class

The circle class has to store all the relevant state and define the relevant behaviour for a circle object. A circle must know where it is...

Circle Class

The circle class has to store all the relevant state and define the relevant behaviour for a circle object. A circle must know where it is...

Circle Class

it must know how big it is...

Circle Class

it must know how big it is...

Circle Class

it must know how big it is...

Circle Class

it must know how to move itself...

Circle Class

it must know how to move itself...

Circle Class

it must know how to move itself...

Circle Class

and it must know how to draw itself.

Circle Class

and it must know how to draw itself.

Circle Class

and it must know how to draw itself.

Circle Class

Lastly, we must put in some default values for the position and the size.

Circle Class

Lastly, we must put in some default values for the position and the size.

Circle Class

Lastly, we must put in some default values for the position and the size.

Circle Class

Lastly, we must put in some default values for the position and the size.

Circle Class

Lastly, we must put in some default values for the position and the size.

Circle Class

Lastly, we must put in some default values for the position and the size.

Circle Class

Lastly, we must put in some default values for the position and the size.

Circle Class

Putting in compile-time defaults is one way of initialising an object. Alternatively, we can make a constructor

Circle Class

Putting in compile-time defaults is one way of initialising an object. Alternatively, we can make a constructor

Circle Class

Putting in compile-time defaults is one way of initialising an object. Alternatively, we can make a constructor

Circle Class

Putting in compile-time defaults is one way of initialising an object. Alternatively, we can make a constructor

Circle Class

Putting in compile-time defaults is one way of initialising an object. Alternatively, we can make a constructor

Circle Class

In fact, we can make several to allow the applet to decide the initialising values.

Circle Class

In fact, we can make several to allow the applet to decide the initialising values.

Circle Class

In fact, we can make several to allow the applet to decide the initialising values.

Circle Class

And we can use the keyword this to disambiguate variable names.

Circle Class

And we can use the keyword this to disambiguate variable names.

Circle Class

And we can use the keyword this to disambiguate variable names.

Circle Class

Finished code.

class Circle {

}
class Circle {
*
}
class Circle {
private int x, y;

}
class Circle {
private int x, y;

}
class Circle {
private int x, y;
*
}
class Circle {
private int x, y;
private int size;

}
class Circle {
private int x, y;
private int size;

}
class Circle {
private int x, y;
private int size;

*}
class Circle {
private int x, y;
private int size;

public void moveTo(int xpos, int ypos){
	x=xpos; y=ypos;
	}

}
class Circle {
private int x, y;
private int size;

public void moveTo(int xpos, int ypos){
	x=xpos; y=ypos;
	}

}
class Circle {
private int x, y;
private int size;

public void moveTo(int xpos, int ypos){
	x=xpos; y=ypos;
	}
*
}
class Circle {
private int x, y;
private int size;

public void moveTo(int xpos, int ypos){
	x=xpos; y=ypos;
	}

public void draw(java.awt.Graphics g){
	g.drawOval(x, y, size, size);
	}

}
class Circle {
private int x, y;
private int size;

public void moveTo(int xpos, int ypos){
	x=xpos; y=ypos;
	}

public void draw(java.awt.Graphics g){
	g.drawOval(x, y, size, size);
	}

}
class Circle {
private int x, y;
private int size;

public void moveTo(int xpos, int ypos){
	x=xpos; y=ypos;
	}

public void draw(java.awt.Graphics g){
	g.drawOval(x, y, size, size);
	}

}
class Circle {
private int x=50, y;
private int size;

public void moveTo(int xpos, int ypos){
	x=xpos; y=ypos;
	}

public void draw(java.awt.Graphics g){
	g.drawOval(x, y, size, size);
	}

}
class Circle {
private int x=50, y;
private int size;

public void moveTo(int xpos, int ypos){
	x=xpos; y=ypos;
	}

public void draw(java.awt.Graphics g){
	g.drawOval(x, y, size, size);
	}

}
class Circle {
private int x=50, y=50;
private int size;

public void moveTo(int xpos, int ypos){
	x=xpos; y=ypos;
	}

public void draw(java.awt.Graphics g){
	g.drawOval(x, y, size, size);
	}

}
class Circle {
private int x=50, y=50;
private int size;

public void moveTo(int xpos, int ypos){
	x=xpos; y=ypos;
	}

public void draw(java.awt.Graphics g){
	g.drawOval(x, y, size, size);
	}

}
class Circle {
private int x=50, y=50;
private int size=50;

public void moveTo(int xpos, int ypos){
	x=xpos; y=ypos;
	}

public void draw(java.awt.Graphics g){
	g.drawOval(x, y, size, size);
	}

}
class Circle {
private int x=50, y=50;
private int size=50;

public void moveTo(int xpos, int ypos){
	x=xpos; y=ypos;
	}

public void draw(java.awt.Graphics g){
	g.drawOval(x, y, size, size);
	}

}
class Circle {
private int x=50, y=50;
private int size=50;

public void moveTo(int xpos, int ypos){
	x=xpos; y=ypos;
	}

public void draw(java.awt.Graphics g){
	g.drawOval(x, y, size, size);
	}

}
class Circle {
private int x, y;
private int size;

public void moveTo(int xpos, int ypos){
	x=xpos; y=ypos;
	}

public void draw(java.awt.Graphics g){
	g.drawOval(x, y, size, size);
	}

}
class Circle {
private int x, y;
private int size;

*public void moveTo(int xpos, int ypos){
	x=xpos; y=ypos;
	}

public void draw(java.awt.Graphics g){
	g.drawOval(x, y, size, size);
	}

}
class Circle {
private int x, y;
private int size;

public Circle(){
	x=50; y=50; size=50;
	}

public void moveTo(int xpos, int ypos){
	x=xpos; y=ypos;
	}

public void draw(java.awt.Graphics g){
	g.drawOval(x, y, size, size);
	}

}
class Circle {
private int x, y;
private int size;

public Circle(){
	x=50; y=50; size=50;
	}

public void moveTo(int xpos, int ypos){
	x=xpos; y=ypos;
	}

public void draw(java.awt.Graphics g){
	g.drawOval(x, y, size, size);
	}

}
class Circle {
private int x, y;
private int size;

public Circle(){
	x=50; y=50; size=50;
	}

*public void moveTo(int xpos, int ypos){
	x=xpos; y=ypos;
	}

public void draw(java.awt.Graphics g){
	g.drawOval(x, y, size, size);
	}

}
class Circle {
private int x, y;
private int size;

public Circle(){
	x=50; y=50; size=50;
	}

public Circle(int xpos, int ypos){
	x=xpos; y=ypos; size=50;
	}

public void moveTo(int xpos, int ypos){
	x=xpos; y=ypos;
	}

public void draw(java.awt.Graphics g){
	g.drawOval(x, y, size, size);
	}

}
class Circle {
private int x, y;
private int size;

public Circle(){
	x=50; y=50; size=50;
	}

public Circle(int xpos, int ypos){
	x=xpos; y=ypos; size=50;
	}

public void moveTo(int xpos, int ypos){
	x=xpos; y=ypos;
	}

public void draw(java.awt.Graphics g){
	g.drawOval(x, y, size, size);
	}

}
class Circle {
private int x, y;
private int size;

public Circle(){
	x=50; y=50; size=50;
	}

public Circle(int xpos, int ypos){
	x=xpos; y=ypos; size=50;
	}

*public void moveTo(int xpos, int ypos){
	x=xpos; y=ypos;
	}

public void draw(java.awt.Graphics g){
	g.drawOval(x, y, size, size);
	}

}
class Circle {
private int x, y;
private int size;

public Circle(){
	x=50; y=50; size=50;
	}

public Circle(int xpos, int ypos){
	x=xpos; y=ypos; size=50;
	}

public Circle(int x, int y, int size){
	this.x=x; this.y=y; this.size=size;
	}

public void moveTo(int xpos, int ypos){
	x=xpos; y=ypos;
	}

public void draw(java.awt.Graphics g){
	g.drawOval(x, y, size, size);
	}

}
class Circle {
private int x, y;
private int size;

public Circle(){
	x=50; y=50; size=50;
	}

public Circle(int xpos, int ypos){
	x=xpos; y=ypos; size=50;
	}

public Circle(int x, int y, int size){
	this.x=x; this.y=y; this.size=size;
	}

public void moveTo(int xpos, int ypos){
	x=xpos; y=ypos;
	}

public void draw(java.awt.Graphics g){
	g.drawOval(x, y, size, size);
	}

}