public class Rectangle extends GeometricObject { //inherits from superclass GeometricObject: // methods: getColor setColor isFilled setFilled getDateCreated toString // Can not directly access inherited 'color' 'filled' 'dateCreated' fields // because they are private in superclass. private double width; private double height; public Rectangle() { //compiler inserts: super(); //call of superclass' 0-arg constructor } public Rectangle(double width, double height) { //compiler inserts: super(); this.width = width; this.height = height; } public double getWidth() { return width; } public void setWidth(double width) { this.width = width; } public double getHeight() { return height; } public void setHeight(double height) { this.height = height; } public double getArea() { return width * height; } public double getPerimeter() { return 2 * (width + height); } }