1: //Rectangle.java 2: 3: /** 4: * Class that represents a rectangle. 5: */ 6: public class Rectangle 7: { 8: private int width; 9: private int height; 10: private int area; 11: 12: public void setDimensions 13: ( 14: int newWidth, 15: int newHeight 16: ) 17: { 18: width = newWidth; 19: height = newHeight; 20: area = width * height; 21: } 22: 23: public int getArea() 24: { 25: return area; 26: } 27: }