public void addCarriage(RollingStock newCarriage) throws TrainException {
		if (train.size() == 0) {
			if (!newCarriage.getClass().getSimpleName().equals(LOCOMOTIVE))
				throw new TrainException("First carriage must be a locomotive");
			else
				train.push(newCarriage);
		} else if (newCarriage.getClass().getSimpleName().equals(LOCOMOTIVE))
			throw new TrainException("cannot add two locomotive");
		else if (this.numberOnBoard() != 0)
			throw new TrainException("people on board");
		else if (train.peek().getClass().getSimpleName().equals(FREIGHTCAR)
				&& newCarriage.getClass().getSimpleName().equals(PASSENGERCAR))
			throw new TrainException(
					"cannot add passengercar after a FREIGHTCAR");
		else
			train.push(newCarriage);
	}