
trenches1
By:
ace on
May 26th, 2010 | syntax:
None | size: 1.30 KB | hits: 18 | expires: Never
import java.util.ArrayList;
/**
* Write a description of class Trenches here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Trenches
{
private ArrayList<Calvary> calvary;
private ArrayList<Infantry> infantry;
private ArrayList<Tank> tank;
/**
* Constructor for objects of class Trenches
*/
public Trenches()
{
infantry = new ArrayList<Infantry>();
calvary = new ArrayList<Calvary>();
tank = new ArrayList<Tank>();
}
/**
* 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 place(Calvary calvary, int position)
{
calvary.setPosition(position);
}
public void place(Infantry infantry, int position)
{
infantry.setPosition(position);
}
public void place(Tank tank, int position)
{
tank.setPosition(position);
}
public void move()
{
calvary.move();
infantry.move();
tank.move();
}
}