Advertisement
tharglet

Untitled

May 2nd, 2014
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.03 KB | None | 0 0
  1. QUESTIONS.JAVA
  2.  
  3. import java.util.Scanner;
  4.  
  5. /**
  6.  *
  7.  * @author tharglet
  8.  */
  9. public class Questions {
  10.  
  11.     /**
  12.      * @param args the command line arguments
  13.      */
  14.     public static void main(String[] args) {
  15.         boolean dontQuit = true;
  16.         Scanner s = new Scanner(System.in);
  17.         while (dontQuit) {
  18.             System.out.println("What's your posion?");
  19.             String input = s.nextLine();
  20.             if (input.equals("cyanide")) {
  21.                 PoisonChoices.doCyanide();
  22.             }  else if(input.equals("warfarin")) {
  23.                 PoisonChoices.doRat();
  24.             } else if (input.equals("quit")) {
  25.                 dontQuit = false;
  26.             }
  27.         }
  28.         System.exit(0);
  29.     }
  30. }
  31.  
  32. POISONCHOICES.JAVA
  33.  
  34. /**
  35.  *
  36.  * @author tharglet
  37.  */
  38. public class PoisonChoices {
  39.  
  40.     public static void doCyanide() {
  41.         System.out.println("Good Choice! Lovely Bottle!");
  42.     }
  43.  
  44.     public static void doRat() {
  45.         System.out.println("I didn't know you were a rat!");
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement