Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Daniel Lawson, 3/6, Chapter 1, page 54 - 2-14(even)
- //-------------------------------------------------------------------------------------------------------------------------------------
- //Exercise 2
- public class Exercise2Spikey
- {
- public static void main (String[] args)
- {
- System.out.println(" \\/");
- System.out.println(" \\\\//");
- System.out.println("\\\\\\///");
- System.out.println("///\\\\\\");
- System.out.println(" //\\\\");
- System.out.println(" /\\");
- }
- }
- //-------------------------------------------------------------------------------------------------------------------------------------
- // Exercise 4
- public class Exercise4Difference
- {
- public static void main (String[] args)
- {
- System.out.println("What is the difference between"); // What is the difference between
- System.out.println("a ' and a \"? Or between a \" and a \\\"?"); // a ' and a "? Or between a " and a \"?
- System.out.println(); // Skip Line
- System.out.println("One is what we see when we're typing our program."); // One is what we see when we're typing our program.
- System.out.println("The other is what appears on the \"console.\""); //The other is what appears on the "console."
- }
- }
- //-------------------------------------------------------------------------------------------------------------------------------------
- // Exercise 6
- public class Exercise6Meta
- {
- /* Hello World Example:
- public class HelloWorld
- {
- public static void main(String[] args)
- {
- System.out.println("Hello World!");
- }
- }
- */
- public static void main(String[] args)
- {
- System.out.println("public class HelloWorld");
- System.out.println("{");
- System.out.println(" public static void main(String[] args)");
- System.out.println(" {");
- System.out.println(" System.out.println(\"Hello World!\");");
- System.out.println(" }");
- System.out.println("}");
- }
- }
- //-------------------------------------------------------------------------------------------------------------------------------------
- // Exercise 8
- public class Exercise8Stewie2
- {
- public static void main(String[] args)
- {
- slashes();
- block(); // block consists of victoryIsMIne, backSlashes
- block();
- block();
- block();
- block();
- }
- public static void slashes()
- {
- System.out.println("//////////////////////");
- }
- public static void backSlashes()
- {
- System.out.println("\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\");
- }
- public static void victoryIsMine()
- {
- System.out.println("|| Victory is mine! ||");
- }
- public static void block()
- {
- victoryIsMine();
- backSlashes();
- }
- }
- //-------------------------------------------------------------------------------------------------------------------------------------
- // Exercise 10
- public class Exercise10Egg2
- {
- public static void main(String[] args)
- {
- noMidEgg();
- mid() ;
- noMidEgg();
- System.out.println(); // space
- mid();
- bot();
- System.out.println(); //space
- top();
- mid();
- bot();
- }
- public static void top()
- {
- System.out.println(" ------- ");
- System.out.println(" / \\ ");
- System.out.println("/ \\");
- }
- public static void mid()
- {
- System.out.println("-\"-'-\"-'-\"-");
- }
- public static void bot()
- {
- System.out.println("\\ /");
- System.out.println(" \\ /");
- System.out.println(" ------- ");
- }
- public static void noMidEgg()
- {
- top();
- bot();
- }
- }
- //-------------------------------------------------------------------------------------------------------------------------------------
- // Exercise 12
- public class Exercise12FightSong
- {
- public static void main (String[] args)
- {
- verse1();
- pause();
- verse2();
- pause();
- verse2();
- pause();
- verse1();
- }
- public static void goTeam()
- {
- System.out.println("Go, team, go!");
- }
- public static void doIt()
- {
- System.out.println("You can do it.");
- }
- public static void verse1()
- {
- goTeam();
- doIt();
- }
- public static void verse2()
- {
- verse1();
- System.out.println("You're the best,");
- System.out.println("In the West.");
- verse1();
- }
- public static void pause()
- {
- System.out.println();
- }
- }
- //-------------------------------------------------------------------------------------------------------------------------------------
- // Exercise 14
- public class Exercise14Lanterns
- {
- public static void main(String[] args)
- {
- trapezoid();
- space();
- shapeOne();
- space();
- shapeTwo();
- }
- public static void five()
- {
- System.out.println(" ***** ");
- }
- public static void nine()
- {
- System.out.println(" ********* ");
- }
- public static void thirteen()
- {
- System.out.println("*************");
- }
- public static void lights()
- {
- System.out.println("* | | | | | *");
- }
- public static void trapezoid()
- {
- five();
- nine();
- thirteen();
- }
- public static void shapeOne()
- {
- trapezoid();
- lights();
- thirteen();
- trapezoid();
- }
- public static void shapeTwo()
- {
- trapezoid();
- five();
- lights();
- lights();
- five();
- five();
- }
- public static void space()
- {
- System.out.println();
- }
- }
- //-------------------------------------------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment