// Inheritance Project // shapehierarchy Module // Source code file: Shape.java // Implements this inheritance hierarchy: // Rectangle --> Shape <-- Circle // Instance variables are set with the constructor. public class Shape { // Red, green, and blue color components private int redComp, greenComp, blueComp; // Constructor public Shape(int redComp, int greenComp, int blueComp) { this.redComp = redComp; this.greenComp = greenComp; this.blueComp = blueComp; } // Getter for color public String getColor( ) { return String.format("%02x%02x%02x", redComp, greenComp, blueComp); } // No area is defined for a Shape object. // This get area method is supplied for consistency. public double getArea( ) { return 0.0; } @Override public String toString() { return String.format("Shape -- Color: %s", getColor( )); } }