Advertisement
KiranAS

Untitled

Oct 21st, 2014
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 12.33 KB | None | 0 0
  1.  
  2. package exercise;
  3.  
  4. import javax.swing.JOptionPane;
  5.  
  6. public class Exercise {
  7.  
  8.     public static void main(String[] args) {
  9.                
  10.         String first_name;      
  11.         first_name= JOptionPane.showInputDialog("Enter your first name");
  12.        
  13.         String last_name;
  14.         last_name= JOptionPane.showInputDialog("Enter your last name");
  15.        
  16.         String name;
  17.         name="Your name is " + first_name + " " + last_name + ". Welcome to JavaQuest alpha 0.1!";      
  18.                              
  19.         JOptionPane.showMessageDialog(null, name);
  20.        
  21.         String weapon;
  22.         weapon= JOptionPane.showInputDialog("What is your weapon of choice?");
  23.        
  24.         String weapon_accept;
  25.         weapon_accept= "Your permanent weapon will be a " + weapon;
  26.        
  27.         JOptionPane.showMessageDialog(null, weapon_accept);
  28.         JOptionPane.showMessageDialog(null, "Good luck with the game!");
  29.         JOptionPane.showMessageDialog(null, "game is loading.... please wait");
  30.         JOptionPane.showMessageDialog(null, "Your name is " + first_name + " " + last_name + "." + " You stand in your room. It is your birthday. There are several items around you. Next to you is your " + weapon + ".");
  31.        
  32.         String pickup_weapon;
  33.         pickup_weapon= JOptionPane.showInputDialog("Pick up " + weapon + "? Yes/No");
  34.        
  35.         switch (pickup_weapon) {
  36.             case "Yes":
  37.                 JOptionPane.showMessageDialog(null, "You picked up the " + weapon );
  38.                 break;
  39.             case "No":
  40.                 JOptionPane.showMessageDialog(null, "Second thoughts arose in your mind. You picked up the " + weapon + " anyway.");
  41.                 break;
  42.         }
  43.        
  44.         JOptionPane.showMessageDialog(null, "You are now armed with your " + weapon + ". You then hear a noise outside your room.");
  45.        
  46.         String noise_check;
  47.         noise_check = JOptionPane.showInputDialog("checkout noise? yeah/nah/I don't know");
  48.        
  49.         switch (noise_check) {
  50.             case "yeah":
  51.                 JOptionPane.showMessageDialog(null, "You ready your " + weapon + " and head out the door to inspect the noise.");
  52.                 JOptionPane.showMessageDialog(null, "With your " + weapon + " in hand, you inspect the dark alleyway that's located near your room in this run-down apartment.");
  53.                
  54.                 String action_huntmonster= JOptionPane.showInputDialog("The source of the noise appears. It is a shadow sneaker, a type of monster that has dark skin and is really slender. What will you do? Use weapon/Interrogate/attack relentlessly");
  55.                
  56.                 switch (action_huntmonster) {
  57.                     case "Use weapon":
  58.                         JOptionPane.showMessageDialog(null, "You begin using your " + weapon + " in an attempt to defeat the intruder, but your efforts weren't good enough. The monster fled.");
  59.                         break;
  60.                     case "Interrogate":
  61.                         JOptionPane.showMessageDialog(null, "You begin asking questions. The monster seems confused by your shaky attempts to communicate with it. The monster has let its guard down.");
  62.                         JOptionPane.showMessageDialog(null, "The monster is still confused and begins approaching you slowly.");
  63.                        
  64.                         String action_communication= JOptionPane.showInputDialog("ready weapon/continue questioning/surprise attack");
  65.                        
  66.                         switch(action_communication) {
  67.                             case "ready weapon":
  68.                                 JOptionPane.showMessageDialog(null, "The monster approaches. It is getting too close for comfort.");
  69.                                 JOptionPane.showMessageDialog(null, "Just as you were readying your " + weapon + ", your neighbor comes out of her room. She starts greeting you in a very loud voice,- She's been drinking.");
  70.                                 JOptionPane.showMessageDialog(null, "Surprised by the sudden interruption, the shadow lurker flees. You lost your chance to kill it.");
  71.                                 JOptionPane.showMessageDialog(null, "You then go back into your room. You are now bored.");
  72.                                 JOptionPane.showMessageDialog(null, "...");
  73.                                 JOptionPane.showMessageDialog(null, "The next day you continue your life as a boring person. You never got the chance to experience anything exciting. Game over.");
  74.                                 System.exit(0);
  75.                                 break;
  76.                             case "continue questioning":
  77.                                 JOptionPane.showMessageDialog(null, "The monster approaches. It is getting too close for comfort.");
  78.                                
  79.                                 String action_confront= JOptionPane.showInputDialog("What are you going to do now? attack/run");
  80.                                
  81.                                 switch (action_confront) {
  82.                                     case "attack":
  83.                                         JOptionPane.showMessageDialog(null, "You proceed to use your " + weapon + ". The monster was too surprised to retaliate. You managed to completely kill it.");
  84.                                         JOptionPane.showMessageDialog(null, "Congratulations on your first kill! :) ");
  85.                                        
  86.                                         String player_status= "Alive";
  87.                                        
  88.                                         JOptionPane.showMessageDialog(null, "....");
  89.                                         JOptionPane.showMessageDialog(null, "You go back to your room.");
  90.                                         JOptionPane.showMessageDialog(null, "You are now too tired to stay up any later. You decide to go to bed.");
  91.                                         JOptionPane.showMessageDialog(null, "....");
  92.                                         JOptionPane.showMessageDialog(null, "It's morning already, and you were waken up by the loud chat notification on your computer.");
  93.                                         JOptionPane.showMessageDialog(null, ".....");
  94.                                         JOptionPane.showMessageDialog(null, "It's a message from your one of your long-distance friends whom you got to know from this multiplayer game called MINECRAFT.");
  95.                                         JOptionPane.showMessageDialog(null, "You try to remember his real name... ");
  96.                                        
  97.                                         String buddy_gender= JOptionPane.showInputDialog("Wait, was it even a he? he/her");
  98.                                        
  99.                                         String buddy= JOptionPane.showInputDialog("And... What was " + buddy_gender + " name again?");
  100.                                        
  101.                                         JOptionPane.showMessageDialog(null, "Chatlog:");
  102.                                         JOptionPane.showMessageDialog(null, "WhitevanIcecreamPerson: Hiya! :D");
  103.                                         JOptionPane.showMessageDialog(null, "You: So " + buddy + ", what made you message me so early in the morning?");
  104.                                         JOptionPane.showMessageDialog(null, "WhitevanIcecreamPerson: I just wanted to tell you that I heard this loud noise last night outside of my student dormitory room.");
  105.                                        
  106.                                         String reply_one= JOptionPane.showInputDialog("Reply: you too?/wow/IDC/what?");
  107.                                        
  108.                                         switch (reply_one) {
  109.                                             case "you too?":
  110.                                                 JOptionPane.showMessageDialog(null, "You: There was one at your house too?");
  111.                                                 JOptionPane.showMessageDialog(null, "WhitevanIcecreamPerson: ...one what? The sound?");
  112.                                                 JOptionPane.showMessageDialog(null, "You: Well yeah. What else would I be referring to?");
  113.                                                 JOptionPane.showMessageDialog(null, "WhitevanIcecreamPerson: You mean you heard it too?");
  114.                                                 System.exit(0);
  115.                                             case "wow":
  116.                                                 JOptionPane.showMessageDialog(null, "You: Oh wow, okay. So what was it?");
  117.                                                 JOptionPane.showMessageDialog(null, "WhitevanIcecreamPerson: Oh well... it was just a cat scratching on the door.... nothing special.");
  118.                                                 System.exit(0);
  119.                                             case "IDC":
  120.                                                 JOptionPane.showMessageDialog(null, "You: Right-right.... another one of those beings from hell?");
  121.                                                 JOptionPane.showMessageDialog(null, "WhitevanIcecreamPerson: what?");
  122.                                                 System.exit(0);
  123.                                         }
  124.                                        
  125.                                         System.exit(0);
  126.                                         break;
  127.                                     case "run":
  128.                                         JOptionPane.showMessageDialog(null, "You decided to run....");
  129.                                         JOptionPane.showMessageDialog(null, "Smart move. You have forgotten that the monster has a slender body, so there is a chance that that thing will be super fast.");
  130.                                         JOptionPane.showMessageDialog(null, "The monster is now chasing you down. Game over.");
  131.                                         System.exit(0);
  132.                                         break;
  133.                                 }
  134.                             case "surprise attack":
  135.                                 JOptionPane.showMessageDialog(null, "The monster retaliates and severs your arm that was used to hold the weapon. You drop down to the floor from the pain. The monster flees.");
  136.                                 JOptionPane.showMessageDialog(null, "...");
  137.                                 JOptionPane.showMessageDialog(null, "The next day, your neighbor has found your cold dead body. You died from severe blood loss, as you laid on the floor in the same spot since last night.");
  138.                                 JOptionPane.showMessageDialog(null, "You have died. game over.");
  139.                                 System.exit(0);
  140.                                 break;
  141.                         }
  142.                        
  143.                         break;
  144.                     default:
  145.                         JOptionPane.showMessageDialog(null, "The monster retaliates and severs your arm that was used to hold the weapon. You drop down to the floor from the pain. The monster flees.");
  146.                         JOptionPane.showMessageDialog(null, "...");
  147.                         JOptionPane.showMessageDialog(null, "The next day, your neighbor has found your cold dead body. You died from severe blood loss, as you laid on the floor in the same spot since last night.");
  148.                         JOptionPane.showMessageDialog(null, "You have died. game over.");
  149.                         System.exit(0);
  150.                 }
  151.                
  152.                 break;
  153.             case "nah":  
  154.                 JOptionPane.showMessageDialog(null, "You holster your " + weapon + "and stay in your room. Are you sure you want to do this though?");
  155.                 JOptionPane.showMessageDialog(null, "You got bored and stayed in your room all day. what a boring person you are.");
  156.                 System.exit(0);
  157.                 break;
  158.             default:
  159.                 JOptionPane.showMessageDialog(null, "You grow restless and fidgety because you are SUPER curious about the noise. You head outside forgetting your " + weapon + "....");
  160.                 JOptionPane.showMessageDialog(null, "You were careless, the noise turned out to be a monster lurking in the shadows and killed you instantly.");
  161.                 System.exit(0);
  162.         }        
  163.         System.exit(0);              
  164.     }
  165.    
  166. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement