Assignment 45

 import java.util.Scanner;
 
 public class ChooseYourOwnAdventure
 {
     public static void main( String[] args )
     {
         Scanner keyboard = new Scanner(System.in);
 
         String answer1, answer2, answer3;
 
         System.out.print("Welcome to an incredibly short adventure!\n\nYou\'re walking down a path when the road forks. Do you go \"left\" or \"right\"?\n>");
         answer1 = keyboard.next();
         
         if (answer1.equals("right"))
         {
         System.out.print("\nYou walk along the right path until it makes an abrupt turn. Pausing for a moment, you notice something shiny in a tree ahead of you. Do you \"climb\" the tree or \"continue\" down the path?\n>");
         answer2 = keyboard.next();
             if (answer2.equals("climb"))
             {
                 System.out.print("\nWhen you approach the object, you see that it is a necklace with a large gemstone hanging from it. Do you \"take\" or \"leave\" the necklace?\n>");
                 answer3 = keyboard.next();
                 
                 if (answer3.equals("take"))
                 {
                     System.out.println("\nAs soon as you touch the necklace, you feel a stinging in your hand. Looking at it with horror, you see your flesh turn to dust and vanish into the breeze as the gem\'s power consumes you. Bound to the necklace, your spirit is forced to haunt the path for the rest of eternity. How dissapointing.");
                 }
                 else if (answer3.equals("leave"))
                 {
                     System.out.println("\nYou leave the necklace. You return home. You are an incredibly boring person, and will remain one for the rest of your life.");
                 }
             }
             else if (answer2.equals("continue"))
             {
                 System.out.print("\nThe path slopes down into a valley, but it is filled with fog wich is too thick to see through properly. Do you \"leave\" or \"continue\" your adventure?\n>");
                 answer3 = keyboard.next();
                 
                 if (answer3.equals("leave"))
                 {
                     System.out.println("You are tired of wwalking and don\'t see any point to continuing. You go home.");
                 }
                 else if (answer3 == "continue")
                 {
                     System.out.println("You are promptly killed by a giant enemy crab.");
                 }
             }
         }
         else if (answer1.equals("left"))
         {
             System.out.print("\nThe path ends at the base of a mountain. You see what appears to be a cave embedded in a nearby cliff face. Do you \"climb\" the mountain or \"enter\" the cave?\n>");
             answer2 = keyboard.next();
             
             if (answer2.equals("climb"))
             {
                 System.out.print("\nYou begin a tedious hike up the mountain. Upon reaching the peak you find sandwich atop an ornate marble pillar. You\'re feeling rather hungry. Do you \"eat\" the sandwich or \"leave\" it?\n>");
                 answer3 = keyboard.next();
                 
                 if (answer3.equals("eat"))
                 {
                     System.out.println("\nYou eat the sandwich. It tastes pretty good.");
                 }
                 else if (answer3.equals("leave"))
                 {
                     System.out.println("\nSuspecting some kind of trick, you leave and head home. You are annoyingly hungry for a while but find a food stand on the way back and eat a burrito.");
                 }
             }
             else if (answer2.equals("enter"))
             {
                 System.out.print("\nThye cave seems very dark at first, but you proceed and find a torch-lit cavern. Suddenly a giant serpent slithers out from behind a rock. It speaks aloud, offering you a chance to win untold riches from its treasure trove if you can best it in combat. Do you \"accept\" or \"decline\" its offer?\n>");
                 answer3 = keyboard.next();
                 
                 if (answer3.equals("accept"))
                 {
                     System.out.println("The serpent presents you with a sword, and you begin to fight it with expert precision. Sensing its defeat, the creature surrendurs and leads you to a pit filled with ancient golden relics and priceless jewels. You die unexpectedly from a heart attack two and a half hours later.");
                 }
                 else if (answer3.equals("decline"))
                 {
                     System.out.println("\nThe serpent is hungry and eats you regardless. How rude.");
                 }
             }
         }
         
         System.out.println("\nTHE END.\n");
     }
 }