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...
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...
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...
it must know how big it is...
it must know how big it is...
it must know how big it is...
it must know how to move itself...
it must know how to move itself...
it must know how to move itself...
and it must know how to draw itself.
and it must know how to draw itself.
and it must know how to draw itself.
Lastly, we must put in some default values for the position and the size.
Lastly, we must put in some default values for the position and the size.
Lastly, we must put in some default values for the position and the size.
Lastly, we must put in some default values for the position and the size.
Lastly, we must put in some default values for the position and the size.
Lastly, we must put in some default values for the position and the size.
Lastly, we must put in some default values for the position and the size.
Putting in compile-time defaults is one way of initialising an object. Alternatively, we can make a constructor
Putting in compile-time defaults is one way of initialising an object. Alternatively, we can make a constructor
Putting in compile-time defaults is one way of initialising an object. Alternatively, we can make a constructor
Putting in compile-time defaults is one way of initialising an object. Alternatively, we can make a constructor
Putting in compile-time defaults is one way of initialising an object. Alternatively, we can make a constructor
In fact, we can make several to allow the applet to decide the initialising values.
In fact, we can make several to allow the applet to decide the initialising values.
In fact, we can make several to allow the applet to decide the initialising values.
And we can use the keyword this to disambiguate variable names.
And we can use the keyword this to disambiguate variable names.
And we can use the keyword this to disambiguate variable names.
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);
}
}