The following text was written to the standard output stream when the TextRectangles program was executed from IntelliJ.
/*
* 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("number Of Rows ? ");
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) {
int i = 1;
while ( i <= nrOfRows) {
drawOneRow(nrOfColumns);
i=i+1;
}
}
private static void drawOneRow(int nrOfColumns) {
int x = 1;
while ( x <= nrOfColumns) {
System.out.print("*");
x = x + 1;
}
System.out.println("");
}
}