daniel_lawson9999

Daniel Lawson Java Exercises Page 54 2-14(even)

Mar 6th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 6.04 KB | None | 0 0
  1. //Daniel Lawson, 3/6, Chapter 1, page 54 - 2-14(even)
  2. //-------------------------------------------------------------------------------------------------------------------------------------
  3. //Exercise 2
  4.  
  5. public class Exercise2Spikey
  6. {
  7.     public static void main (String[] args)
  8.     {
  9.      System.out.println("  \\/");
  10.      System.out.println(" \\\\//");
  11.      System.out.println("\\\\\\///");
  12.      System.out.println("///\\\\\\");
  13.      System.out.println(" //\\\\");
  14.      System.out.println("  /\\");
  15.     }
  16. }
  17.  
  18. //-------------------------------------------------------------------------------------------------------------------------------------
  19. // Exercise 4
  20.  
  21. public class Exercise4Difference
  22. {
  23.     public static void main (String[] args)
  24.     {
  25.         System.out.println("What is the difference between"); // What is the difference between
  26.        System.out.println("a ' and a \"? Or between a \" and a \\\"?"); // a ' and a "? Or between a " and a \"?
  27.        System.out.println(); // Skip Line
  28.        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.
  29.        System.out.println("The other is what appears on the \"console.\""); //The other is what appears on the "console."
  30.  
  31.     }
  32.  
  33. }
  34. //-------------------------------------------------------------------------------------------------------------------------------------
  35. // Exercise 6
  36.  
  37.  
  38. public class Exercise6Meta
  39. {
  40.     /* Hello World Example:
  41.  
  42.     public class HelloWorld
  43.     {
  44.     public static void main(String[] args)
  45. {
  46.     System.out.println("Hello World!");
  47. }
  48.  
  49.   }
  50.    */
  51.  
  52.     public static void main(String[] args)
  53.     {
  54.         System.out.println("public class HelloWorld");
  55.         System.out.println("{");
  56.         System.out.println("   public static void main(String[] args)");
  57.         System.out.println("   {");
  58.         System.out.println("      System.out.println(\"Hello World!\");");
  59.         System.out.println("   }");
  60.         System.out.println("}");
  61.     }
  62.  
  63. }
  64.  
  65. //-------------------------------------------------------------------------------------------------------------------------------------
  66. // Exercise 8
  67.  
  68.  
  69. public class Exercise8Stewie2
  70. {
  71.     public static void main(String[] args)
  72.     {
  73.         slashes();
  74.         block(); // block consists of victoryIsMIne, backSlashes
  75.         block();
  76.         block();
  77.         block();
  78.         block();
  79.     }
  80.     public static void slashes()
  81.     {
  82.         System.out.println("//////////////////////");
  83.     }
  84.     public static void backSlashes()
  85.     {
  86.         System.out.println("\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\");
  87.     }
  88.     public static void victoryIsMine()
  89.     {
  90.         System.out.println("|| Victory is mine! ||");
  91.     }
  92.     public static void block()
  93.     {
  94.         victoryIsMine();
  95.         backSlashes();
  96.     }
  97.  
  98.  
  99. }
  100. //-------------------------------------------------------------------------------------------------------------------------------------
  101. // Exercise 10
  102.  
  103. public class Exercise10Egg2
  104. {
  105.     public static void main(String[] args)
  106.     {
  107.         noMidEgg();
  108.         mid() ;
  109.         noMidEgg();
  110.         System.out.println(); // space
  111.         mid();
  112.         bot();
  113.         System.out.println(); //space
  114.         top();
  115.         mid();
  116.         bot();
  117.  
  118.     }
  119.     public static void top()
  120.     {
  121.         System.out.println("  -------  ");
  122.         System.out.println(" /       \\ ");
  123.         System.out.println("/         \\");
  124.     }
  125.     public static void mid()
  126.     {
  127.         System.out.println("-\"-'-\"-'-\"-");
  128.     }
  129.     public static void bot()
  130.     {
  131.         System.out.println("\\         /");
  132.         System.out.println(" \\       /");
  133.         System.out.println("  -------  ");
  134.  
  135.     }
  136.     public static void noMidEgg()
  137.     {
  138.         top();
  139.         bot();
  140.     }
  141.  
  142. }
  143. //-------------------------------------------------------------------------------------------------------------------------------------
  144. // Exercise 12
  145.  
  146. public class Exercise12FightSong
  147. {
  148.     public static void main (String[] args)
  149.     {
  150.         verse1();
  151.  
  152.         pause();
  153.  
  154.         verse2();
  155.  
  156.         pause();
  157.  
  158.         verse2();
  159.  
  160.         pause();
  161.  
  162.         verse1();
  163.  
  164.     }
  165.     public static void goTeam()
  166.     {
  167.         System.out.println("Go, team, go!");
  168.     }
  169.     public static void doIt()
  170.     {
  171.         System.out.println("You can do it.");
  172.     }
  173.  
  174.     public static void verse1()
  175.     {
  176.         goTeam();
  177.         doIt();
  178.     }
  179.     public static void verse2()
  180.     {
  181.         verse1();
  182.         System.out.println("You're the best,");
  183.         System.out.println("In the West.");
  184.         verse1();
  185.     }
  186.     public static void pause()
  187.     {
  188.         System.out.println();
  189.     }
  190. }
  191. //-------------------------------------------------------------------------------------------------------------------------------------
  192. // Exercise 14
  193.  
  194. public class Exercise14Lanterns
  195. {
  196.     public static void main(String[] args)
  197.     {
  198.         trapezoid();
  199.  
  200.         space();
  201.  
  202.         shapeOne();
  203.  
  204.         space();
  205.  
  206.         shapeTwo();
  207.  
  208.     }
  209.  
  210.  
  211.     public static void five()
  212.     {
  213.         System.out.println("    *****    ");
  214.     }
  215.     public static void nine()
  216.     {
  217.         System.out.println("  *********  ");
  218.     }
  219.     public static void thirteen()
  220.     {
  221.         System.out.println("*************");
  222.     }
  223.     public static void lights()
  224.     {
  225.         System.out.println("* | | | | | *");
  226.     }
  227.     public static void trapezoid()
  228.     {
  229.         five();
  230.         nine();
  231.         thirteen();
  232.     }
  233.  
  234.     public static void shapeOne()
  235.     {
  236.         trapezoid();
  237.         lights();
  238.         thirteen();
  239.         trapezoid();
  240.     }
  241.     public static void shapeTwo()
  242.     {
  243.         trapezoid();
  244.         five();
  245.         lights();
  246.         lights();
  247.         five();
  248.         five();
  249.     }
  250.     public static void space()
  251.     {
  252.         System.out.println();
  253.     }
  254. }
  255. //-------------------------------------------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment