
import java.util.Scanner;

/**
 *  This program draws a rectangle.
 *
 *  @author Mark Young (A00000000)
 */
public class VoidMethods {

    public static void main(String[] args) {
        // create the variables
        Scanner kbd = new Scanner(System.in);
        int height, width;

        // Tell the user what we're doing
        printIntroduction();
        pause();

        // Ask the user for the rectangles measurements
        System.out.print("Enter the height and width of the rectangle: ");
        height = kbd.nextInt();
        width = kbd.nextInt();
        kbd.nextLine();
        pause();

        // draw the rectangle
        drawRectangle(height, width);
        pause();
    }

    /**
     * Introduce this program to the user
     */
    public static void printIntroduction() {
        System.out.println("\n\n"
                + "Draw a Rectangle\n"
                + "----------------\n\n"
                + "This program draws a rectangle.\n\n"
                + "By Mark Young (A00000000)");
    }

    /**
     * Draw a rectangle made of stars.
     *
     * @param height the number of lines for the rectangle
     * @param width the number stars on each line
     */
    public static void drawRectangle(int height, int width) {
        for (int line = 1; line <= height; ++line) {
            printNStarsLine(width);
        }
    }

    /**
     * Print a line containing stars.
     *
     * @param numStars the number of stars to print on the line
     */
    public static void printNStarsLine(int numStars) {
        for (int star = 1; star <= numStars; ++star) {
            System.out.print("*");
        }
        System.out.println();
    }

    /**
     * Prompt user then wait for them to press the enter key.
     */
    public static void pause() {
        Scanner kbd = new Scanner(System.in);
        System.out.print("\n... press enter ...");
        kbd.nextLine();
        System.out.println();
    }

}
