// Miya Natsuhara // 07-03-2019 // CSE142 // TA: Grace Hopper // This program prints out an ASCII art tapestry whose size can be scaled. /* DEVELOPMENT NOTES: ((Note: this is not something you should include in your own programs; this is included here to aid in your understanding and to provide additional context for the program.)) This was our final version of the program, including the class constant that can be used to modify the size of the output. The work to find the correct expressions for size 3 and size 4, and then the generalized expression, can be found in tapestry_scratch.txt. */ public class Tapestry3 { // class constant used to scale the output public static final int SIZE = 3; public static void main(String[] args) { drawFringe(); drawTopHalf(); drawBottomHalf(); drawFringe(); } // Prints out the fringe of the tapestry public static void drawFringe() { System.out.print("#"); for (int i = 1; i <= SIZE * 4; i++) { System.out.print("="); } System.out.println("#"); } // Prints out the top half of the tapestry public static void drawTopHalf() { for (int line = 1; line <= SIZE; line++) { System.out.print("|"); drawSpaces(line); System.out.print("<>"); for (int dot = 1; dot <= 4 * line - 4; dot++) { System.out.print("."); } System.out.print("<>"); drawSpaces(line); System.out.println("|"); } } // Prints out the given number of spaces, staying on the same line // int line: the current line number where the spaces that should be printed public static void drawSpaces(int line) { for (int space = 1; space <= -2 * line + 2 * SIZE; space++) { System.out.print(" "); } } // Prints out the bottom half of the tapestry public static void drawBottomHalf() { for (int line = SIZE; line >= 1; line--) { System.out.print("|"); drawSpaces(line); System.out.print("<>"); for (int dot = 1; dot <= 4 * line - 4; dot++) { System.out.print("."); } System.out.print("<>"); drawSpaces(line); System.out.println("|"); } } }