Last active
March 21, 2017 18:16
-
-
Save gitaficionado/8298d22abfcb485d0f097436fdd12cc6 to your computer and use it in GitHub Desktop.
Program version 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FigureDemo { | |
public static void main(String[] args) { | |
System.out.println(" ______"); | |
System.out.println(" / \\"); | |
System.out.println("/_________"); | |
System.out.println("\\ /"); | |
System.out.println(" \\______/"); | |
System.out.println(); | |
System.out.println("\\ /"); | |
System.out.println(" \ __________"); | |
System.out.println("+--------+"); | |
System.out.println(); | |
System.out.println(" ______"); | |
System.out.println(" / \\"); | |
System.out.println("/ \\"); | |
System.out.println("___________"); | |
System.out.println("\\ /"); | |
System.out.println(" \\______/"); | |
System.out.println(); | |
System.out.println(" ______"); | |
System.out.println(" / ___________"); | |
System.out.println("/ \\"); | |
System.out.println("+--------+"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Prints several figures, with methods for structure and redundancy. | |
public class DrawFigureThree { | |
public static void main(String[] args) { | |
egg(); | |
________(); | |
stopSign(); | |
_______(); | |
} | |
// Draws the top half of an an egg figure. | |
public static void eggTop() { | |
System.out.println(" ______"); | |
System.out.println(" / \\"); | |
System.out.println("/ \\"); | |
} | |
// Draws the bottom half of an egg figure. | |
public static void eggBottom() { | |
System.out.println("\\ /"); | |
System.out.println(" \\______/"); | |
} | |
// Draws a complete egg figure. | |
public static void egg() { | |
eggTop(); | |
eggBottom(); | |
System.out.println(); | |
} | |
// Draws a teacup figure. | |
public static void teaCup() { | |
eggBottom(); | |
line(); | |
System.out.println(); | |
} | |
// Draws a stop sign figure. | |
public static void stop_____() { | |
eggTop(); | |
System.out.println("| ______ |"); | |
eggBottom(); | |
System.out.println(); | |
} | |
// Draws a figure that looks sort of like a hat. | |
public static void ____() { | |
eggTop(); | |
line(); | |
} | |
// Draws a line of dashes. | |
public static void line() { | |
System.out.println("___________"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DrawFigureTwo { | |
public static void main(String[] args) { | |
egg(); | |
teaCup(); | |
stopSign(); | |
hat(); | |
} | |
public static void egg() { | |
System.out.println(" ______"); | |
System.out.println(" / \\"); | |
System.out.println("/ \\"); | |
System.out.println("\\ /"); | |
System.out.println(" \\______/"); | |
System.out.println(); | |
} | |
public static void teaCup() { | |
System.out.println("\\ /"); | |
System.out.println(" _____________"); | |
System.out.println("______________"); | |
System.out.println(); | |
} | |
public static void stopSign() { | |
System.out.println(" ______"); | |
System.out.println(" / \\"); | |
System.out.println("/ \\"); | |
System.out.println("| STOP |"); | |
System.out.println("\\ /"); | |
System.out.println(" \\______/"); | |
System.out.println(); | |
} | |
public static void hat() { | |
System.out.println(" ______"); | |
System.out.println(" / \\"); | |
System.out.println("/ \\"); | |
System.out.println("+--------+"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment