//package npw; // //import java.util.Scanner; // //public class TextRectangles { // public static void main(String[] args) { // int flag2 = 0; // int flag = 0; // Scanner input = new Scanner(System.in); // // while (flag == 0) { // // System.out.println("rows: "); // int nrOfRows = input.nextInt(); // // System.out.println("columns: "); // int nrOfColumns = input.nextInt(); // // // for (int x = 0; x < nrOfRows; x++) { // System.out.println(" "); // for (int y = 0; y < nrOfColumns; y++) { // System.out.print("*"); // } // } // // System.out.println(" "); // // // flag2 = 0; // while (flag2 == 0) { // flag2 = 1; // System.out.println("Would you like to go again? input yes or no"); // String response = input.next(); // if (response.equalsIgnoreCase("yes")) { // // System.out.println(); // } else if (response.equalsIgnoreCase("no")) { // // flag = 1; // // } else { // // System.out.println("sorry, please input one of the following"); // flag2 = 0; // // } // } // // // } // } // package npw; import java.util.Scanner; public class TextRectangles { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Number of rows? "); int row = sc.nextInt(); System.out.print("Number of columns? "); int column = sc.nextInt(); drawRectangle(row,column); } 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 i = 1; i <= nrOfColumns; i = i + 1) { System.out.print("*"); } System.out.println(" "); } }