(Enable GeometricObject comparable) Modify the GeometricObject class to implement the Comparable interface, and define a static max method in the GeometricObject class for finding the larger of two GeometricObject objects.
Draw the UML diagram and implement the new GeometricObject class. Write a test program that uses the max method to find the larger of two circles and the larger of two rectangles.
Programming Exercise 13.5. Use the following template for the program:
public class Exercise13_05 {
// Main method
public static void main(String[] args) {
// Create two comarable circles
Circle1 circle1 = new Circle1(5);
Circle1 circle2 = new Circle1(4);
// Display the max circle
Circle1 circle = (Circle1)GeometricObject1.max(circle1, circle2);
System.out.println("The max circle's radius is " +
circle.getRadius());
System.out.println(circle);
}
}
abstract class GeometricObject1 implements Comparable {
// Implement it
}
// Circle.java: The circle class that extends GeometricObject
class Circle1 extends GeometricObject1 {
// Implement it
}