public abstract class ThreeDShape implements MyComparable { public final boolean isLarger(MyComparable other) throws InvalidComparableTypeException { if( other instanceof ThreeDShape ) { ThreeDShape obj = (ThreeDShape)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 ThreeDShape ) { ThreeDShape obj = (ThreeDShape)other; if( this.getArea() == obj.getArea() ) return true; else return false; } throw new InvalidComparableTypeException(); } public abstract double getVolume(); public abstract double getArea(); }