1 package npw; 2 3 import java.util.Scanner; 4 5 public class TextRectangles { 6 public static void main(String[] args) { 7 System.out.println("Please input the dimensions of the rectangle (Rows, Columns):"); 8 Scanner scanner = new Scanner(System.in); 9 int Rows = scanner.nextInt(); 10 int Columns = scanner.nextInt(); 11 System.out.println("number of rows: " + Rows); 12 System.out.println("number of Columns: " + Columns); 13 drawRectangle(Rows,Columns); 14 15 16 } 17 18 private static void drawRectangle(int nrOfRows, int nrOfColumns) { 19 int i = 1; 20 while ( i <= nrOfRows) { 21 drawOneRow(nrOfColumns); 22 i=i+1; 23 } 24 } 25 26 private static void drawOneRow(int nrOfColumns) { 27 int p = 0; 28 while ( p < nrOfColumns) { 29 p = p + 1; 30 System.out.print("*"); 31 32 } 33 System.out.println(); 34 35 36 } 37 } 38