// CSE 142, Winter 2007 // Martson Limsteppkai // // This program draws a "mirror" figure using nested loops. // Initial version. // public class Mirror1 { public static void main(String[] args) { drawArea1(); drawArea2(); drawArea3(); drawArea1(); } // prints top/bottom line of # and = marks public static void drawArea1() { System.out.print("#"); for (int equal = 1; equal <= 16; equal++) { System.out.print("="); } System.out.println("#"); } // prints expanding pattern of <> for top half of figure public static void drawArea2() { for (int line = 1; line <= 4; line++) { // | System.out.print("|"); // spaces for (int space = 1; space <= (line * -2 + 8); space++) { System.out.print(" "); } // <> System.out.print("<>"); // . for (int dot = 1; dot <= (line * 4 - 4); dot++) { System.out.print("."); } // <> System.out.print("<>"); // spaces for (int space = 1; space <= (line * -2 + 8); space++) { System.out.print(" "); } // | System.out.println("|"); } } // prints contracting pattern of <> for bottom half of figure public static void drawArea3() { for (int line = 4; line >= 1; line--) { System.out.print("|"); for (int space = 1; space <= (line * -2 + 8); space++) { System.out.print(" "); } System.out.print("<>"); for (int dot = 1; dot <= (line * 4 - 4); dot++) { System.out.print("."); } System.out.print("<>"); for (int space = 1; space <= (line * -2 + 8); space++) { System.out.print(" "); } System.out.println("|"); } } }