Project I: Adventure Project

Code

    /// Name: Ryan McAteer
    /// Period: 5
    /// Program Name: Project Adventure
    /// File Name: Project1.java
    /// Date Finished: 11/18/15

import java.util.Scanner;

class Project1
{
      public static void main(String[] args) 
      {
          
          Scanner keyboard = new Scanner(System.in);
          
          String room1, room2, room3;
        room1 = room2 = room3 = "room";
        System.out.println( "Welcome to Ryan's  Adventure! (I'm not creative)" );
        System.out.println();
        System.out.println( "You are in a creepy house! Would you like to go [upstairs], to the [main hall], or [basement]? " );
        System.out.print( "> " ); 
        room1 = keyboard.nextLine();
        
        if ( room1.equals("upstairs") )
            {
                System.out.println( "There are two more rooms, the [bedroom] and the [bathroom] which would you like to go to?" );
                System.out.print( "> " );
                room2 = keyboard.nextLine();
                    if ( room2.equals("bedroom") )
                    {
                    System.out.println( "Would you like to [sleep] or [turn on the light]? " );
                    System.out.print("> ");
                    room3 = keyboard.nextLine();
                        if ( room3.equals("sleep") )
                        {
                        System.out.println("You take a nap." );
                        }
                        else if ( room3.equals("turn on the light") )
                        {
                        System.out.println("You turn on the light and see a nice bedroom.");
                        }
                    }
                    else if ( room2.equals("bathroom") )
                    {
                    System.out.println( "Would you like to [flush the toilet] or [turn on the sink]? " );
                    System.out.print( "> " );
                    room3 = keyboard.nextLine();
                        if ( room3.equals("flush the toilet") )
                        {
                        System.out.println( "It is blocked. You need a plunger." );
                        }
                        else if ( room3.equals("turn on the sink") )
                        {
                        System.out.println("Green goo flows out");
                        }
                    } 
                }
        else if ( room1.equals("main hall") )
            {
            System.out.println( "There are two more rooms, the [kitchen] and the [living room] which would you like to go to?" );
            System.out.print( "> " );
            room2 = keyboard.nextLine();
                if ( room2.equals("kitchen") )
                {
                System.out.println( "You see a muffin and a cookie." );
                System.out.println( "Would you like to [eat the muffin] or [eat the cookie]? " );
                System.out.print( "> " );
                room3 = keyboard.nextLine();
                    if ( room3.equals("eat the muffin") )
                    {
                    System.out.println( "You eat the muffin and taste poison. You die." );
                    }
                    else if ( room3.equals("eat the cookie") )
                    {
                    System.out.println( "The cookie tastes funny. I don't think they are chocolate chips... " );
                    }
                }
                else if ( room2.equals("living room") )
                {
                System.out.println( "There is a television and an ipod. " );
                System.out.println( "Would you like to [watch television] or [listen to itunes radio]? " );
                System.out.print( "> " );
                room3 = keyboard.nextLine();
                    if ( room3.equals("watch televison") )
                    {
                    System.out.println( "You begin to watch The Walking Dead." );
                    }
                    else if ( room3.equals("listen to itunes radio") )
                    {
                    System.out.println( "You listen to the calm radio station." );
                    }   
                }
            }
          else if ( room1.equals("basement") )
          {
                System.out.println( "You see two doors, one [wooden] the other [metal]. Which do you open?" );
                System.out.print( "> " );
                room2 = keyboard.nextLine();
                    if ( room2.equals("wooden") )
                    {
                    System.out.println( "You see a barrel and an old book. Do you [open] the barrel or [read]? " );
                    System.out.print("> ");
                    room3 = keyboard.nextLine();
                        if ( room3.equals("open") )
                        {
                        System.out.println("You flip the lid of the barrel to find it filled with coca cola." );
                        }
                        else if ( room3.equals("read") )
                        {
                        System.out.println("You open the book and discover the formula for eternal life.");
                        }
                    }
                    else if ( room2.equals("metal") )
                    {
                    System.out.println( "You see a safe. Do you [look] for lasers or [walk] to the safe? " );
                    System.out.print( "> " );
                    room3 = keyboard.nextLine();
                        if ( room3.equals("look") )
                        {
                        System.out.println( "You find several lasers, avoid them, and retrieve the treasure." );
                        }
                        else if ( room3.equals("walk") )
                        {
                        System.out.println("Several lasers detect you and burn you to a crisp.");
                        }
                    } 
                }
              
    }
}


    

Picture of the output

This should work