// Zorah Fung, CSE 142 // 06/30/2014 // // Prints out ASCII art picture of a rug with a diamond pattern // and is scaled based on the class constant SIZE. public class Tapestry { public static final int SIZE = 4; public static void main(String[] args) { fringe(); topHalf(); bottomHalf(); fringe(); } // Prints a line of ='s between two # public static void fringe() { // # 16 ='s # System.out.print("#"); for (int equals = 1; equals <= 4 * SIZE; equals++) { System.out.print("="); } System.out.println("#"); } // Prints the top half of a diamond public static void topHalf() { for (int line = 1; line <= SIZE; line++) { System.out.print("|"); for (int spaces = 1; spaces <= -2 * line + SIZE * 2; spaces++) { System.out.print(" "); } System.out.print("<>"); for (int dots = 1; dots <= 4 * line - 4; dots++) { System.out.print("."); } System.out.print("<>"); for (int spaces = 1; spaces <= -2 * line + 2 * SIZE; spaces++) { System.out.print(" "); } System.out.println("|"); } } // Prints the bottom half of a diamond public static void bottomHalf() { for (int line = SIZE; line >= 1; line--) { System.out.print("|"); for (int spaces = 1; spaces <= -2 * line + SIZE * 2; spaces++) { System.out.print(" "); } System.out.print("<>"); for (int dots = 1; dots <= 4 * line - 4; dots++) { System.out.print("."); } System.out.print("<>"); for (int spaces = 1; spaces <= -2 * line + SIZE * 2; spaces++) { System.out.print(" "); } System.out.println("|"); } } }