public abstract class TwoDShape implements MyComparable { public final boolean isLarger(MyComparable other) throws InvalidComparableTypeException { if( other instanceof TwoDShape ) { TwoDShape obj = (TwoDShape)other; if( this.getArea() > obj.getArea() ) return true; else return false; } throw new InvalidComparableTypeException(); } public final boolean isEqual(MyComparable other) throws InvalidComparableTypeException { if( other instanceof TwoDShape ) { TwoDShape obj = (TwoDShape)other; if( this.getArea() == obj.getArea() ) return true; else return false; } throw new InvalidComparableTypeException(); } public abstract double getArea(); }