import java.util.Random; public class Tardis { private int energy; public Tardis(int startEnergy) { energy = startEnergy; } public Location calculateCoordinates(int maxRow, int maxColumn) { Random aGenerator = new Random(); Location aLocation = new Location(); // Randomly generate a new set of (row,column) // values to move the tardis to. The randomly // generated value will be from 0 - (maxRow/maxColumn) // because those values dictate the size of the world // containing the tardis. aLocation.setRow(aGenerator.nextInt(maxRow)); aLocation.setColumn(aGenerator.nextInt(maxColumn)); System.out.println("Tardis rematerializing at (r/c): " + aLocation.getRow() + "/" + aLocation.getColumn()); energy--; return(aLocation); } public boolean hasEnergy() { if (energy > 0) return(true); else return(false); } }