// Inheritance Project // shapehierarchy Module // Source code file: Rectangle.java // Implements this inheritance hierarchy: // Rectangle --> Shape <-- Circle // Instance variables are set with the constructor. public class Rectangle extends Shape{ // Instance variables private double width, height; // Constructor public Rectangle(int r, int g, int b, double w, double h) { super(r, g, b); width = w; height = h; } // For a rectangle, area = w * h public double getArea( ) { return width * height; } @Override public String toString( ) { return String.format("Rectangle -- Color %s Width: %.4f Height: %.4f", getColor( ), width, height); } }