Design an interface named colorable with a void method


JAVA Program--

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 GeometricObjects. (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 all four sides Area is 12.00 Area is 20.25 Color all four sides

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Design an interface named colorable with a void method
Reference No:- TGS01522231

Now Priced at $10 (50% Discount)

Recommended (99%)

Rated (4.3/5)