Assignment 45

code

///Name: Mutsu Osoegawa
///Period: 7
///Project Name: 10/15/2015
///File Name: ChooseYourAdventure.java
///Date: 10/15/2015

import java.util.Scanner;
public class ChooseYourAdventure
{
    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 MUTSU'S TINY ADVENTURE!" );
        System.out.println();
        System.out.println( "You are in a creep house! Would you like to go \"upstairs\" or to the \"main hall\"? " );
        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." );
                System.out.print( "> " );
                room2 = keyboard.nextLine();
                    if ( room2.equals("bedroom") )
                    {
                    System.out.println( "Would you like to \"sleep\" or \"look in the bookshelf\"? " );
                    System.out.print("> ");
                    room3 = keyboard.nextLine();
                        if ( room3.equals("sleep") )
                        {
                        System.out.println("You fall into an eternal slumber never to wake up again." );
                        }
                        else if ( room3.equals("look in the bookshelf") )
                        {
                        System.out.println("You find a book and decide to read a story.");
                        }
                    }
                    else if ( room2.equals("bathroom") )
                    {
                    System.out.println( "Would you like to \"look in the cabinet\" or \"take a shower\"? " );
                    System.out.print( "> " );
                    room3 = keyboard.nextLine();
                        if ( room3.equals("look in the cabinet") )
                        {
                        System.out.println( "Nothing interesting happens and the story ends." );
                        }
                        else if ( room3.equals("take a shower") )
                        {
                        System.out.println("You become clean");
                        }
                    } 
                }
        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." );
            System.out.print( "> " );
            room2 = keyboard.nextLine();
                if ( room2.equals("kitchen") )
                {
                System.out.println( "You are hungry." );
                System.out.println( "Would you like to \"search the refridgerator\" or \"search the pantry\"? " );
                System.out.print( "> " );
                room3 = keyboard.nextLine();
                    if ( room3.equals("search the refridgerator") )
                    {
                    System.out.println( "No food is to be found. You are still hungry..." );
                    }
                    else if ( room3.equals("search the pantry") )
                    {
                    System.out.println( "You find cookies. You now have food to eat. " );
                    }
                }
                else if ( room2.equals("living room") )
                {
                System.out.println( "There is a tv and a cd player. " );
                System.out.println( "Would you like to \"watch tv\" or \"listen to music\"? " );
                System.out.print( "> " );
                room3 = keyboard.nextLine();
                    if ( room3.equals("watch tv") )
                    {
                    System.out.println( "You are entertained for quite some time." );
                    }
                    else if ( room3.equals("listen to music") )
                    {
                    System.out.println( "You jam out to some classical music." );
                    }   
                }
            }
    }
}