AreaMeasurer.java.html

  1  import java.awt.Rectangle;
  2  
  3  /**
  4     Objects of this class measure rectangles by area.
  5  */
  6  public class AreaMeasurer implements Measurer
  7  {
  8     public double measure(Object anObject)
  9     {
 10        Rectangle aRectangle = (Rectangle) anObject;
 11        double area = aRectangle.getWidth() * aRectangle.getHeight();
 12        return area;
 13     }
 14  }