Modify the geometricobject class to implement the


Instructions: Properly indent your code and include appropriate comments. Follow instructions given for each problem in the textbook.

Required

EnableGeometricObject 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. Use the provied UML diagram and implement the new GeometricObject1, Circle1, and Rectangel1 classes. Write a test program that uses the max method to find the larger of two circles and the larger of two rectangles.
Sample main provided.

*Hint create a new GeometricObject class called GeometricObject1 which will implement Comparable.

abstract class GeometricObject1 implements Comparable

GeommetricObject1 will need to have a compareTo method and the method
public static GeometricObject1 max(GeometricObject1 o1,GeometricObject1 o2)

{

which will use the compareTo method to return the relationship between o1 and o2, the value, 0,1, or -1.

You will also need a class Circle1 that extends GeometricObject1.

class Circle1 extends GeometricObject1

{

You will also need a class Rectangle1 that extends GeometricObject1.

classRectangle1 extends GeometricObject1

{

Classes GeometricObject, Circle and Rectangle have been provided for you as a starting point.

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Modify the geometricobject class to implement the
Reference No:- TGS01062771

Expected delivery within 24 Hours