// Kyle Thayer, CSE 142 // 06/29/2015 // // Prints out ASCII art picture of a // rug with a diamond pattern public class TapestryKyleSolution { public static final int SIZE = 4; public static void main(String[] args) { fringe(); topHalf(); bottomHalf(); fringe(); } //Draws the fringe of the tapestry public static void fringe(){ System.out.print("#"); for(int i = 1; i <= 4 * SIZE; i++){ System.out.print("="); } System.out.println("#"); } //Draws the top half pattern of the tapestry public static void topHalf(){ for(int i=1; i <= SIZE; i++){ System.out.print("|"); for(int j = 1; j <= -2*i + 2 * SIZE; j++){ System.out.print(" "); } System.out.print("<>"); for(int j = 1; j <= 4 * i - 4; j++){ System.out.print("."); } System.out.print("<>"); for(int j = 1; j <= -2*i + 2 * SIZE; j++){ System.out.print(" "); } System.out.print("|"); System.out.println(); } } //Draws the top half pattern of the tapestry public static void bottomHalf(){ for(int i=1; i <= SIZE; i++){ System.out.print("|"); for(int j = 1; j <= 2*i - 2; j++){ System.out.print(" "); } System.out.print("<>"); for(int j = 1; j <= -4 * i + SIZE*4; j++){ System.out.print("."); } System.out.print("<>"); for(int j = 1; j <= 2*i - 2; j++){ System.out.print(" "); } System.out.print("|"); System.out.println(); } } }