The following code is used to implement the compare To method in the ComparableRectangle class. This method returns 1 if
Posted: Fri Jul 08, 2022 6:40 am
The following code is used to implement the compare To method in the ComparableRectangle class. This method returns 1 if the calling object has a greater area than the passed in object, -1 if the calling object has a lesser area than the passed in object, and 0 if the objects have equal areas. public int compare To (ComparableRectangle o) { if (getArea() } return ;; else if (getArea() return else return ; o.getArea() o.getArea()