Source of Rectangle2.java


  1: /**
  2:  Another class that represents a rectangle.
  3: */
  4: public class Rectangle2
  5: {
  6:     private int width;
  7:     private int height; 
  8: 
  9:     public void setDimensions(int newWidth, int newHeight)
 10:     {
 11:         width = newWidth;
 12:         height = newHeight;
 13:     }
 14: 
 15:     public int getArea()
 16:     {
 17:                 return width * height;
 18:         }
 19: }
 20: