
tank1
By:
ace on
May 26th, 2010 | syntax:
None | size: 0.87 KB | hits: 23 | expires: Never
/**
* Write a description of class Tanks here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Tank
{
// instance variables - replace the example below with your own
int position;
/**
* Constructor for objects of class Tanks
*/
public Tank()
{
// initialise instance variables
position = this.position;
}
/**
* An example of a method - replace this comment with your own
*
* @param y a sample parameter for a method
* @return the sum of x and y
*/
public void setPosition(int position)
{
this.position = position;
}
public int getPosition()
{
position = position+1;
return position;
}
public void move()
{
this.position = getPosition()+2;
}
}