TextRectangles.java
1    package npw;
2    
3    import java.util.Scanner;
4    
5    /* 
6     *Program to make rectangles in the debugging window 
7     * based on the inputs of the user 
8     */
9    
10   public class TextRectangles {
11       public static void main(String[] args) {
12           boolean x = true;
13           while(x = true){
14               Scanner scan = new Scanner(System.in);
15               System.out.println("Enter # of rows");
16               int nrOfRows = scan.nextInt();
17               System.out.println("Enter # of columns");
18               int nrOfColumns = scan.nextInt();
19               drawRectangle(nrOfRows, nrOfColumns);
20           }
21       }
22   
23       private static void drawRectangle(int nrOfRows, int nrOfColumns) {
24           int i = 1;
25           while ( i <= nrOfRows) {
26               drawOneRow(nrOfColumns);
27               i=i+1;
28           }
29       }
30   
31       private static void drawOneRow(int nrOfColumns) {
32           for (int i = 1; i <= nrOfColumns; i++){
33               System.out.print("*");
34           }
35           System.out.println("");
36       }
37   }
38