Related questions with answers
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.
Draw a UML diagram that involves Colorable, Square, and GeometricObject. Write a test program that creates an array of five GeometricObjects. For each object in the array, display its area and invoke its howToColor method if it is colorable.
Solution
VerifiedIn this exercise, we need to define an interface named Colorable and the class Square that extends class GeometricObject and implements Colorable. First, we are going to write the interface Colorable
public interface Colorable {
public abstract String howToColor();
}
Create a free account to view solutions
Create a free account to view solutions
Recommended textbook solutions

Intro to Java Programming, Comprehensive Version
10th Edition•ISBN: 9780133761313Y. Daniel Liang
Fundamentals of Database Systems
7th Edition•ISBN: 9780133970777Ramez Elmasri, Shamkant B. Navathe
Introduction to Algorithms
3rd Edition•ISBN: 9780262033848Charles E. Leiserson, Clifford Stein, Ronald L. Rivest, Thomas H. Cormen
Introduction to Algorithms
4th Edition•ISBN: 9780262046305Charles E. Leiserson, Clifford Stein, Ronald L. Rivest, Thomas H. CormenMore related questions
1/4
1/7