public class DrawRectangle
2: import java.util.Scanner;
4: /**
5: * This program draws a rectangle
6: *
7: * @author Mark Young (A00000000)
8: */
9: public class DrawRectangle {
11: public static void main(String[] args) {
12: // create the variables
13: Scanner kbd = new Scanner(System.in);
14: int height, width;
16: // Tell the user what we're doing
17: System.out.println("This program draws a rectangle.");
19: // Ask the user for the rectangles measurements
20: System.out.print("Enter the height and width of the rectangle: ");
21: height = kbd.nextInt();
22: width = kbd.nextInt();
23: kbd.nextLine();
25: // draw the rectangle
26: for (int line = 1; line <= height; ++line) {
27: for (int star = 1; star <= width; ++star) {
28: System.out.print("*");
29: }
30: System.out.println();
31: }
32: }
34: }