/** File: Circle.java * Copy: Copyright (c) 1998 David Green * Vers: 1.0.2 2001/05/15 dgg -- original coding * Vers: 1.0.5 2006/11/16 sma -- Documentation standards for Java source code */ public class Rectangle extends Shape { /** * Width and length of the triangle. */ protected int width; protected int length; /** * Constructor */ private Rectangle() { } /** * Method to create the rectangle with a name, width and lenght. */ public Rectangle( String a_name, int a_width, int a_length ) { name = a_name; width = a_width; length = a_length; } /** * Method to calculate and to return the area of the rectangle. */ public int getArea() { return width * length; } /** * Method to return the name of the rectangle. */ public String getName() { return name; } /** * Method to return the width of the rectangle. */ public int getWidth() { return width; } /** * Method to return the length of the rectangle. */ public int getLength() { return length; } /** * Method to resize the rectangle by a percentage. */ public void resize( int percentage ) { width = ( width * (100 + percentage) ) / 100; length = ( length * (100 + percentage) ) / 100; } }