CS/SWE 332 Assignment 8
Fall 2020


Goal: Contract for equals()

Submit via Blackboard.
Assignment:

Liskov's implementation of equals() for the Point3 class (see figure 7.16, page 182) is wrong. We know this must be true because Point2 is instantiable and Point3 adds client-visible state (namely the z coordinate). Hence, of the three properties (Liskov substitution principle, symmetry, and transitivity), only two are possible.

Your assignment is to figure out which property is broken. Demonstrate your result with a suitable JUnit test. You'll have to fill in enough of the Point2 and Point3 classes to make them functional, including constructors and an overridden equals() method for Point2. You should code the equals() method in Point2 with Bloch's standard recipe.

As before, the deliverable is a clear, concise story documenting that you have completed the assignment and highlighting the key points.

Grading Criteria: