SWE 619 Assignment 2
Spring 2013


Goal: Exception handling: Converting preconditions to defined behavior.

Take your solution for Assignment 1. Modify the class LastDiff so that lastDiff() handles its precondition in two of the ways described by Liskov. Specifically, in class LastDiffA, use the approach that defines special return elements for arguments that do not satisfy the preconditions. Be sure to document this properly in the Requires and Effects clauses. In class LastDiffB, use an exception handling approach instead. Again, be sure to document this properly in the Requires and Effects clauses.

You do not need to provide any user interface, just the classes LastDiffA and LastDiffB.

Provide a decent set of JUnit tests.