CMIS 345
Week 7
Read 11.4 Interfaces and 11.5 Comparable.
Using the Week 3 Circle, Rectangle and Ellipse classes
make them implement the Comparable interface.
based on the objects' area. p. 372
GeometricObjects are not comparable.
Make an interface Smooth that has abstract method eccentricity(),
and double constants CIRCLE=0 and PARABOLA=1.
Circle and Ellipse implement Smooth.
A circle has an eccentricity of 0.
An ellipse has eccentricity=sqrt(a*a-b*b)/a where a is the longer axis.
and is always between 0 and 1, exclusive.
Make an interface Polygonal that has abstract method numberSides().
and integer constants TRIANGLE, RECTANGLE, QUADRILATERAL, PENTAGON
with appropriate values.
Rectangle implements Polygonal. A rectangle is 4-sided.
Use the Week 7 TestGeometricHeirarchy to test your code.
Zip the five files (not counting and not including the driver or GeometricObject.java
which needs no change) into one attachment.