Assignemnt #45: Choose Your Own Adventure!

Code

    /// Name: Kelsey Lieberman
    /// Period 5
    /// Program Name: ChooseAdventure
    /// File Name: ChooseAdventure.java
    /// Date Finished: 11/3/2015
    
import java.util.Scanner;

public class ChooseAdventure
{
    public static void main(String[] args )
    {
        Scanner keyboard = new Scanner(System.in);
        
        String r1, r2, r3, r4, r5, r6, r7;
        
        System.out.println("WELCOME TO KELSY'S FREAKIN CRAZY ADVENTUREEEEEE");
        System.out.println("\nYou wake up in a dank, unfamiliar, and creepy house! Do you want to go \"upstairs\" or \"downstairs\"?");
        System.out.print(">> ");
        r1 = keyboard.next();
        
        if (r1.equals("upstairs"))
        {
            System.out.println("\nYou climb the stairs and find yourself in a bedroom with an open door going into what looks like a bathroom. Do you want to walk into the \"bathroom\" or look in the \"closet\"");
            System.out.print(">> ");
            r2 = keyboard.next();
            
                if (r2.equals("bathroom"))
                {
                    System.out.println("\nYou walk into the bathroom and find a shower. Do you want to take a shower? (\"yes\" or \"no\")");
                    System.out.print(">> ");
                    r4 = keyboard.next();
                    
                        if (r4.equals("yes"))
                        {
                            System.out.println("\nYou turn the shower on and as you are getting in, slip on the wet floor and die.");  
                        }
                        else if (r4.equals("no"))
                        {
                            System.out.println("\nYou turn to walk away from the shower but you trip from friction on the dry floor and your shoes, and die. ");
                        }
                        else
                        {
                            System.out.println("\nPlease enter either \"yes\" or \"no\"");
                        }
                }
                else if (r2.equals("closet"))
                {
                    System.out.println("\nYou open the closet to find a drawer with a box sitting on top of the drawer. Do you want to open the \"drawer\" or open the \"box\"?");
                    System.out.print(">> ");
                    r5 = keyboard.next();
                    
                        if (r5.equals("drawer"))
                        {
                            System.out.println("\nYou open the drawer to find a venomous snake inside! The snake bites you and you die.");  
                        }
                        else if (r5.equals("box"))
                        {
                            System.out.println("\nYou struggle to open the box, which turns out to be locked, spending hours trying different ways to open it. You can hear someting inside of it and know it is important. Finally, you manage to break the lock. You take a deep breath and prepare yourself for whatever might be inside. Slowly, you begin to take the top off the box. It obviously hasn't been opened in a while because it is dusty and the top does not come off easily. After much effort, you surprisingly pop the top off the box. Slowly and carefully, you start to peer into the box. Your eyes inchloser and closer to over the edge of the box; you can almost see inside. The suspense kills you.");
                        }
                        else
                        {
                            System.out.println("\nPlease enter either \"drawer\" or \"box\"");
                        }
                }
                else
                {
                    System.out.println("\nPlease enter either \"bathroom\" or \"closet\"");
                }
        }
        
        else if (r1.equals("downstairs"))
        {
            System.out.println("\nYou begin walking down the rickety stairs, but suddenly they collapse under your feet and you fall into a pitch black room. You remember a flashlight in your pocket left over from that thing you needed it for. Do you want to turn the flashlight \"on\" or walk in the \"dark\"?");
            System.out.print(">> ");
            r3 = keyboard.next();
                
                if (r3.equals("on"))
                {
                    System.out.println("\nYou turn the flashlight on and suddenly... Oh no! Mr. Skeltal spooked you! Would you like to updoot? (\"yes\" or \"no\")");
                    System.out.print(">> ");
                    r6 = keyboard.next();
                    
                        if (r6.equals("yes"))
                        {
                            System.out.println("\nYou do not updoot quick enough and Mr. Skeltal spooks you again! You die of a heart attack.");  
                        }
                        else if (r6.equals("no"))
                        {
                            System.out.println("\nYou die from calcium deficiency.");
                        }
                        else
                        {
                            System.out.println("\nPlease enter either \"yes\" or \"no\"");
                        }
                }
                else if (r3.equals("dark"))
                {
                    System.out.println("\nWhy wouldn't you use the flashlight? It's freakin dark up in here. You trip in the dark and cut your hand on something. Do you want to use your flashlight to examine it? (\"yes\" or \"no\")");
                    System.out.print(">> ");
                    r7 = keyboard.next();
                    
                        if (r7.equals("yes"))
                        {
                            System.out.println("\nYou turn the flashlight on and suddenly... Oh no! Mr. Skeltal spooked you! You forget to updoot and die from calcium deficiency.");  
                        }
                        else if (r7.equals("no"))
                        {
                            System.out.println("\nYou can feel the blood running down your arm but you don't care because you're not a wuss. To show that you're nothing to mess with, you punch the thing that cut you. It slices your hand open further and you die from blood loss.");
                        }
                        else
                        {
                            System.out.println("\nPlease enter either \"yes\" or \"no\"");
                        }
                }
                else
                {
                    System.out.println("\nPlease enter either \"on\" or \"dark\"");
                }    
        }
        
        else
        {
            System.out.println("\nPlease enter either \"upstairs\" or \"downstairs\"");
        }
    }
}
    

Picture of the output

Assignment 45