Final exam notes

Oof, the final was clearly too long — about half the students left at least one problem completely blank. (And that includes students who actually needed the points, not just Sorcerers.) To compensate for this, I just gave everybody who took it a bonus +25XP.

In case you’re interested, here’s my solution to the Dog problem. The most common errors on this problem were:

  1. Not throwing an Exception from .move(). I tried to telegraph this by saying:

    The move method should not return any return value; however, in the case of the dog hitting the electric fence, clients who call it should be made aware that the move was not completely successful.

    If those words are to be followed, literally the only way to accomplish this in Java is to have .move() throw an Exception in the case where it cannot actually move the Dog the specified amount. (This is very much like the .drive() method in the Car example; see Blueprints pp.71-72.)

  2. Not getting the constructor calls right. Remember, a subclass calls super(...) to invoke its superclass’s constructor. (See Blueprints pp.179-180.) In this case, the right implementations for the constructors would be something like:
        Dog(Breed b, Yard y) {
            this.breed = b;
            this.myYard = y;
        Greyhound(Yard y) {

(Btw, +1 humor XP to the student who named the class “Dawg“.)

Props to Kanghuaroo, who got the top score of +199XP (before the curve)!

Comments are closed.