// Marty Stepp, CSE 142, Autumn 2008 // This program draws lines and boxes of stars using parameters. public class Stars { public static void main(String[] args) { line(13); line(7); line(35); System.out.println(); box(5, 3); box(10, 6); box(70, 23); } // Draws a line of stars of the given length. public static void line(int totalStars) { for (int star = 1; star <= totalStars; 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); // top for (int line = 1; line <= height - 2; line++) { // mid System.out.print("*"); for (int space = 1; space <= width - 2; space++) { System.out.print(" "); } System.out.println("*"); } line(width); // bottom } }