Write an abstract Box class that has three integer dimensions : length, width, and depth , and two methods: surfaceArea() and volume().
Write an abstract Box class that has three integer dimensions : length, width, and depth , and two methods: surfaceArea() and volume(). Box should implement the Comparable interface, but leave compareTo(...) undefi ned. That is, compareTo(…) is an abstract method.
Create two subclasses of Box: BoxArea and BoxVolume . Each of these subclasses extends Box and does nothing extra except implements the abstract method compareTo(...) .
Note that since Box implements Comparable , the derived classes BoxArea and BoxVolume do not also need to explicitly implement Comparable , but they do need to implement compareTo(…).
• BoxArea defi nes compareTo(...) by comparing surface areas.
• BoxVolume defi nes compareTo(...) by comparing volumes.
Write a class with a single static method public static boolean orderedUp( Comparable[] x, int size) that determines whether or not the elements of Comparable array x are in strict ascending order.
Write a test class with a main() method that asks the user to enter three dimensions for each of fi ve different boxes. Create two arrays of BoxArea and BoxVolume , each containing the data for these fi ve boxes.
Your test class should print a message indicating whether or not the boxes in each array are in strict ascending order according to the appropriate compareTo(…) methods.