
public class Rectangle
{
	private int length;
	private int width;

	public Rectangle()
	{
		this( 4, 4 );
	}

	public Rectangle( int length, int width )
	{
		this.length = length;
		this.width = width;
	}

	public void printFigure()
	{
		for( int i = 0; i < length; i++ ) {
			for( int j = 0; j < width; j++ ) {
				System.out.print("* ");
			}
			System.out.println();	// print newline
		}
	}

	public void printFigureWithHeader()
	{
		// print column header
		System.out.print("  ");	// print the spaces before the header
		for( int i = 0; i < width; i++ ) {
			System.out.print( (i+1) + " " );
		}

		// print rows with row numbers
		for( int i = 0; i < length; i++ ) {

			System.out.print( (i+1) + " " );	// print row number

			for( int j = 0; j < width; j++ ) {	// print asterisks
				System.out.print("* ");
			}

			System.out.println();			// print newline
		}
	}
}

