CS/SWE 332 Assignment 6
Due Wednesday, October 10, 2018

Goal: Verification

Submit via Blackboard.
Assignment: Consider the Members class from the lecture slides. Note that the slides discuss 3 variations of the class - an original, broken, version, and two repaired versions. Further, there are two rep-invariants: call them repOk1() and repOk2().

  1. Implement all three versions. Call them Members, Members1, and Members2. Replace the type Person with String.
  2. Add an isMember() observer method so that you can determine whether or not a given person is a member.
  3. Clean up the contracts (and the code!) so that null persons can't join or leave. Either JavaDoc or postcondition descriptions are fine. Note that you'll have to decide what to do about null arguments to the observer method isMember().
  4. Write JUnit tests that: Both of these tests, obviously, will fail.
  5. Rewrite these same two tests to call methods in Members1 and Members2. All four of these tests, obviously, must pass. Make sure you associate the appropriate rep-invariant with Members1 and with Members2.

Grading Criteria: