/** * instructor: Ray Ortigas * Date: Summer 2000 * http://www.dgp.toronto.edu/~rayo/tutorials/108/2000summer/ */ // A circle. public class Circle extends Shape { // The radius of this circle. public int radius; // Constructs a new circle with the given radius 'r'. public Circle(int r) { radius = r; } // Returns the area of this circle. public int getArea() { return (int)(Math.PI * radius * radius); } // Returns a string representation of this public String toString() { // Notice that we are using the toString() method inside // Shape (Circle's superclass) to construct part of our string. return super.toString() + "; radius = " + radius; } }