©2005 Felleisen, Proulx, et. al.

4.4  Problem

A GUI Component is one of the following:

The first four components are primitive components, while the Table is a compound component. Each component contains a label and some additional data.

  1. Draw the class diagram for this collection of classes.

  2. Design the methods needed to count the number of primitive GUI components in a given GUI Component.

  3. Design the methods needed to determine the height of a given GUI Component. The height of a table is the sum of the heights of the Rows. The height of a Row is the maximum of its components' heights.