// Stuart Reges // 1/15/09 // // Variation of Stars1 that uses parameterized methods to draw various lines // and boxes. public class Stars2 { public static void main(String[] args) { line(13); line(7); line(35); box(10, 5); box(5, 6); } // Draws a line of stars of the given length. public static void line(int count) { for (int star = 1; star <= count; star++) { System.out.print("*"); } System.out.println(); } // Draws a box of stars of the given width and height. public static void box(int width, int height) { line(width); for (int line = 1; line <= height - 2; line++) { System.out.print("*"); for (int space = 1; space <= width - 2; space++) { System.out.print(" "); } System.out.println("*"); } line(width); } }