// CSE 142 Lecture 5 // Parameters // Prints lines of stars and boxes of stars using parameters. public class Stars { public static void main(String[] args) { line(13); line(7); line(35); box(10, 5); box(4, 4); } // Prints s count number of times on one line. public static void repeat(String s, int count) { for (int i = 1; i <= count; i++) { System.out.print(s); } } // Prints a line of stars consisting of count number of stars. public static void line(int count) { repeat("*", count); System.out.println(); } // Prints a width by height box of stars. public static void box(int width, int height) { line(width); for (int i = 1; i <= height - 2; i++) { System.out.print("*"); repeat(" ", width - 2); System.out.println("*"); } line(width); } }