Question: 1. Design an interface named Colorable with a method named howToColor(). 2. Design a class named Square that extends GeometricObject and implements Colorable. 3. Implement
1. Design an interface named Colorable with a method named howToColor().
2. Design a class named Square that extends GeometricObject and implements Colorable.
3. Implement howToColor (in the Square class only) to display the message Color all four sides.
4. The Square class contains a data field side with getter and setter methods, and a constructor for constructing a Square with a specified side
5. Write a test program that creates an array of six GeometricObject (two circles, two rectangles, and two squares).
6. Override the toString method so as to display the area of the rectangle.
7. For each object in the array, display the information and invoke its howToColor method if it is colorable. (Hint: Use instanceof operator).
8. Implement the following comparable interface in the Square class: Public interface Comparable { Public int compareTo(E o); } Override the compareTo method so as to compare the area of the square objects.
9. Create an array of squares and sort it.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
