// CSE 142 Lecture 5 // Parameters // Draw an ascii art mirror that can scale based on SIZE constant. public class MirrorParams { public static final int SIZE = 4; public static void main(String[] args) { line(); top(); bottom(); line(); } // Prints the line at the top or bottom of the figure. public static void line() { System.out.print("#"); repeat("=", 4 * SIZE); System.out.println("#"); } // Prints the top half of the figure. public static void top() { for (int line = 1; line <= SIZE; line++) { System.out.print("|"); repeat(" ", line * -2 + 2 * SIZE); System.out.print("<>"); repeat(".", line * 4 - 4); System.out.print("<>"); repeat(" ", line * -2 + 2 * SIZE); System.out.println("|"); } } // Prints the bottom half of the figure. public static void bottom() { for (int line = SIZE; line >= 1; line--) { System.out.print("|"); repeat(" ", line * -2 + 2 * SIZE); System.out.print("<>"); repeat(".", line * 4 - 4); System.out.print("<>"); repeat(" ", line * -2 + 2 * SIZE); System.out.println("|"); } } // Prints s count times on the same line. public static void repeat(String s, int count) { for (int i = 1; i <= count; i++) { System.out.print(s); } } }