Here is the code we wrote today (5th period, but both classes were similar):
public class Train { private int numLocos; private int numCars; public Train() { numLocos = 1; numCars = 0; } public void increaseSize(int newCars) { numCars += newCars; numLocos += (newCars / 5); } public double speed() { return 20 - (double)numCars / numLocos; } } public class VacuumCleaner { private boolean charged; //whether vacuum is charged private int amountOfDirt; //how much dirt is in the vacuum private int dirtCapacity; //how much it can hold public VacuumCleaner(int dirtCap) { charged = true; amountOfDirt = 0; dirtCapacity = dirtCap; } public int use(int availDirt) { if(!charged) return 0; int amt = Math.min(availDirt, dirtCapacity-amountOfDirt); amountOfDirt += amt; charged = false; return amt; } public void charge() { charged = true; } public int empty() { int temp = amountOfDirt; amountOfDirt = 0; return temp; } }