Exercise Set 6: Interfaces

Exercise 6.1 The given UML diagram describes classes that define a list of measurable objects with a sample method totalSize and a sample class MString on which the list is tested.

Exercise 6.2 The Java Comparable interface is designed to support uniform comparison of objects.

Exercise 6.3 Develop further tests and uses of the list of Comparable objects from the previous exercise. Develop the class CompRectangle which extends the Java class Rectangle by implementing the Comparable interface. The comparison is based on the area of the rectangle. Test the class CompList using the class CompRectangle. Draw the UML diagram of this collection of classes.