A06

Due Date: Friday, 5 March 2021
File(s) to be submitted: FigureInfo.java, Measurable.java, Circle.java, Oval.java, Rectangle.java, Triangle.java
Sample Output: SampleOutput.html
Starter Files:


SUBMIT   /   Check

Figure Info (Interfaces and Polymorphism)

Summary

Revise the Measurable interface so that it extends Comparable<Measurable>.
Note that once you make this change, the Shape classes will all have errors in them -- they don't implement the compareTo(Measurable) method. The implements Measurable clause now includes a promise to implement that method.
Revise the shape classes so that they actually implement the compareTo(Measurable) method.
Note that by making Measurable extend Comparable<Measurable>, the promise to be Measurable implies a promise to be Comparable<Measurable>, so you don't need to promise that again.

Also, you shouldn't change the shape classes from implementing Measurable.

Revise the program FigureInfo so that it reads in three objects of each shape, storing all twelve of the shapes in a single array, then sorts that array and prints it out in a nice table. (Right now it reads in a single instance of each shape and prints out those four shapes in a table -- not sorted.)

Details

There's not much more to say than I said above.


SUBMIT   /   Check