CMPS 144L Spring 2024
Lab #4 (Feb. 15/16): Using Partitioning to Explore Inheritance and Loop Invariants

Both of this week's lab activities use array partitioning as a vehicle for exploring important topics. The first activity, like the activities of last week's lab, focuses on inheritance.

However, this week's activity is different from last week's in that you are being asked to "factor out" the common parts of two given concrete Java classes so as to produce an abstract class that will serve as the parent of both of them. (This process is known as generalization (or abstraction). You saw an example of this when we recognized that the RollOverCounter, StoppingCounter, and WarningCounter classes should all be children of an abstract BoundedCounter class.)

The second activity focuses on using loop invariants to guide the development of loops.

Activity #1: Red/Blue Partitioning: Inheritance

Activity #2: Red/White/Blue Partitioning: Loop Invariants