// Marty Stepp, CSE 142, Autumn 2007 // This program prints an ASCII text figure that // looks like a mirror. public class Mirror { public static void main(String[] args) { line(); topHalf(); bottomHalf(); line(); } // Prints the top half of the rounded mirror. public static void topHalf() { for (int line = 1; line <= 4; line++) { // pipe System.out.print("|"); // spaces for (int j = 1; j <= -2 * line + 8; j++) { System.out.print(" "); } // <> System.out.print("<>"); // dots . for (int j = 1; j <= 4 * line - 4; j++) { System.out.print("."); } // <> System.out.print("<>"); // spaces for (int j = 1; j <= -2 * line + 8; j++) { System.out.print(" "); } // pipe System.out.println("|"); } } // Prints the bottom half of the rounded mirror. public static void bottomHalf() { for (int line = 4; line >= 1; line--) { // pipe System.out.print("|"); // spaces for (int j = 1; j <= -2 * line + 8; j++) { System.out.print(" "); } // <> System.out.print("<>"); // dots . for (int j = 1; j <= 4 * line - 4; j++) { System.out.print("."); } // <> System.out.print("<>"); // spaces for (int j = 1; j <= -2 * line + 8; j++) { System.out.print(" "); } // pipe System.out.println("|"); } } // Prints the #==# line at the top and bottom of the mirror. public static void line() { System.out.print("#"); for (int j = 1; j <= 16; j++) { System.out.print("="); } System.out.println("#"); } }