TextRectangles.java
 /* 
  * Program to draw rectangles of stars in the standard output stream. The 
  * dimensions of the rectangle are read from the standard input stream. 
  */

package npw;

import java.util.Scanner;


public class TextRectangles {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.println("run: ");
        System.out.print("number of rows? ");
        int rows = scanner.nextInt();
        System.out.print("number of columns? ");
        int columns = scanner.nextInt();

        drawRectangle(rows, columns);


    }

    private static void drawRectangle(int nrOfRows, int nrOfColumns) {
        int i = 1;
        while ( i <= nrOfRows) {
            drawOneRow(nrOfColumns);
            i=i+1;
        }
    }

    private static void drawOneRow(int nrOfColumns) {
        for (int x = 0; x < nrOfColumns; x += 1) {
            System.out.print("*");
        }
        System.out.println();
    }
}