The following text was written to the standard output stream when the TextRectangles program was executed from Netbeans.
/*
*Program to draw rectangles of stars in the standard output stream. The
*dmensions of the rectangle are read from the standard input stream.
*/
package npw;
import java.util.Scanner;
/**
*
* @author dmaslows
*/
public class TextRectangles {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
System.out.println("number of rows? ");
Scanner scanner = new Scanner(System.in);
int nrOfRows = scanner.nextInt();
System.out.println("number of columns? ");
int nrOfColumns = scanner.nextInt();
drawRectangle(nrOfRows, nrOfColumns);
}
private static void drawRectangle(int nrOfRows, int nrOfColumns) {
for (int a = 0; a < nrOfRows; a++) {
for (int b = 0; b < nrOfColumns; b++) {
System.out.print("*");
}
System.out.println();
}
}
}