// Helene Martin, CSE 142 // Displays text shapes to the console // Demonstrates procedural decomposition to capture output structure // and reduce redundancy // We first identified the 4 major structural elements of the output // and made them into methods. // We then found sections of output that were reused and made those // into methods as well. public class Shapes { public static void main(String[] args) { drawEgg(); drawBowl(); drawStop(); drawHat(); } public static void drawTop() { System.out.println(" ______"); System.out.println(" / \\"); System.out.println("/ \\"); } public static void drawBottom() { System.out.println("\\ /"); System.out.println(" \\______/"); } public static void drawEgg() { drawTop(); drawBottom(); System.out.println(); } public static void drawLine() { System.out.println("+--------+"); } public static void drawBowl() { drawBottom(); drawLine(); System.out.println(); } public static void drawStop() { drawTop(); System.out.println("| STOP |"); drawBottom(); } public static void drawHat() { drawTop(); drawLine(); } }