Question: Design an interface named Colorable with a void method named howToColor(). Every class of a colorable object must implement the Colorable interface. Design a class
Design an interface named Colorable with a void method named howToColor(). Every class of a colorable object must implement the Colorable interface. Design a class named Square that extends GeometricObject and implements Colorable. Implement howToColor () to display the message Color all four .sides. Write a test program that creates an array of five Geometric-Objects, (new Square(2), new Circle(5), new Square(5), new Rectangle(3, 4), new Square(4, 5)) For each object in the array, display its area and invoke its howToColor () method if it is colorable. Expected results: Area is 4.00 Color all four sides Area is 78.54 Area is 25.00 Color alt four sides Area is 12.00 Area is 20.25 Color all four sides
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
