/** * instructor: Ray Ortigas * Date: Summer 2000 * http://www.dgp.toronto.edu/~rayo/tutorials/108/2000summer/ */ // A rectangle. public class Rectangle extends Shape { // The height of this rectangle. public int height; // The width of this rectangle. public int width; // Constructs a new rectangle with height 'h' and width 'w'. public Rectangle(int h, int w) { height = h; width = w; } // Returns the area of this rectangle. public int getArea() { return height * width; } // Returns a string representation of this rectangle. public String toString() { return "x = " + x + "; y = " + y + "; height = " + height + "; width = " + width; } // A method only available to rectangles. public void exclusiveRectangleMethod() { System.out.println("I'm a rectangle! I'm special!"); } }