Skip to content

Instantly share code, notes, and snippets.

@gitaficionado
Last active March 21, 2017 18:16
Show Gist options
  • Save gitaficionado/8298d22abfcb485d0f097436fdd12cc6 to your computer and use it in GitHub Desktop.
Save gitaficionado/8298d22abfcb485d0f097436fdd12cc6 to your computer and use it in GitHub Desktop.
Program version 2
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("+--------+");
}
}
// 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("___________");
}
}
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