Assignment #45 Choose Your Own Adventure

Code

    /// Name: Matthew Lorence
    /// Period: 5
    /// Program Name: Adventure
    /// File Name: Adventure.java
    
    import java.util.Scanner;

    public class Adventure
    {
        public static void main ( String [] args )
        {
            Scanner keyboard = new Scanner( System.in );
            
            String first, second, third;
            
            System.out.println( "WELCOME TO MATTHEW' TINY ADVENTURE" );
            System.out.println( "You are in a creepy house! Would you like to go upstairs or into the kitchen?" );
            first = keyboard.next();
                               
            if ( first.equals("upstairs"))
            {
                System.out.println( "You make it to a hallway. Do you go in the playroom or bedroom?" );
                second = keyboard.next();
                
                if ( second.equals("playroom"))
                {
                    System.out.println( "You see a toy chest.  Do you open it?" );
                    third = keyboard.next();
                    if ( third.equals("yes"))
                    {
                        System.out.println( "You get bit by a snake and die." );
                    }
                    else if ( third.equals( "no"))
                    {
                        System.out.println( "You don't get medical supplies and die." );
                    }
                }
                else if ( second.equals("bedroom"))
                {
                    System.out.println( "You see a bed.  Do you sleep in it?" );
                    third = keyboard.next();
                    if (third.equals("no"))
                    {
                        System.out.println( "You turn into a zombie. The end." );
                    }
                    else if (third.equals("yes"))
                    {
                        System.out.println( "The teddy bear in the bed eats you alive." );
                    }
                }
            }
                    
                    
                    
            else if (first.equals("kitchen"))
            {
                System.out.println( "You see a refrigerator and cabinet.  Which do you go to?" );
                second = keyboard.next();
                    
                if (second.equals("refrigerator"))
                {
                    System.out.println( "Do you open the refrigerator?" );
                    third = keyboard.next();
                    
                    if (third.equals("yes"))
                    {
                        System.out.println("A zombie jumps out and eats you alive.");
                    }
                    else if (third.equals("no"))
                    {
                        System.out.println("You starve to death and die.");
                    }
                }
                    
                else if (second.equals("cabinet"))
                {
                    System.out.println("Do you open the cabinet?");
                    third = keyboard.next();
                
                    if (third.equals("yes"))
                    {
                        System.out.println("A cat jumps out and claws you to death.");
                    }
                    else if (third.equals("no"))
                    {
                        System.out.println("You are unable to find water and die.");
                    }
                    
                }
            }
        }
    }
        
        
    

Picture of the output

Assignment 45