// Marty Stepp, CSE 142, Autumn 2008 // This program draws a figure of an ASCII mirror. public class Mirror { public static void main(String[] args) { line(); topHalf(); bottomHalf(); line(); } public static void line() { System.out.println("#================#"); } public static void topHalf() { for (int line = 1; line <= 4; line++) { // print contents of each line // | System.out.print("|"); // spaces for (int space = 1; space <= (-2 * line + 8); space++) { System.out.print(" "); } // <> System.out.print("<>"); // . for (int dot = 1; dot <= 4 * line - 4; dot++) { System.out.print("."); } // <> System.out.print("<>"); // spaces for (int space = 1; space <= (-2 * line + 8); space++) { System.out.print(" "); } // | System.out.println("|"); } } // same as top half only in reverse order public static void bottomHalf() { for (int line = 4; line >= 1; line--) { // print contents of each line // | System.out.print("|"); // spaces for (int space = 1; space <= (-2 * line + 8); space++) { System.out.print(" "); } // <> System.out.print("<>"); // . for (int dot = 1; dot <= 4 * line - 4; dot++) { System.out.print("."); } // <> System.out.print("<>"); // spaces for (int space = 1; space <= (-2 * line + 8); space++) { System.out.print(" "); } // | System.out.println("|"); } } }