Question: CODE IN JAVA (The Colorable and Comparable interfaces) Design an interface named Colorable with a void method named howToColor(). Every class of a colorable object

CODE IN JAVA

(The Colorable and Comparable interfaces) 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 (the one we have worked on during lecture, https://github.com/iglidraci/cen215-java/blob/main/2022- 2023/chapter13_abstract_interfaces/GeometricObject.java) and implements Colorable and Comparable. Implement howToColor to display the message Color all four sides. The Square class contains a data field side with getter and setter methods, and a constructor for constructing a Square with a specified side. The Square class has a private double data field named side with its getter and setter methods. It has a no-arg constructor to create a Square with side 0, and another constructor that creates a Square with the specified side. Override the equals method in the Object class. Two Square objects are equal if their areas are the same. Draw a UML diagram that involves Colorable, Comparable, 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.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!