Project Number 1 Choose Your Own Slightly Longer Adventure (EC)

Code

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

    public class LongerAdventure
    {
        public static void main ( String [] args )
        {
            Scanner keyboard = new Scanner( System.in );
                
            String first, second, third;
                
            System.out.println( "WELCOME TO MATTHEW'S TINY ADVENTURE" );
            System.out.println( "You are in a creepy house! Would you like to go upstairs, downstairs, 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("downstairs"))
            {
                System.out.println( "You see a bathroom and a living room.  Which do you go to?" );
                second = keyboard.next();
                        
                if (second.equals("bathroom"))
                {
                    System.out.println( "You see a shower? Do you use it?" );
                    third = keyboard.next();
                        
                    if (third.equals("yes"))
                    {
                        System.out.println("The water is really acid and you burn alive.");
                    }
                    else if (third.equals("no"))
                    {
                        System.out.println("Your awful stench attracts a vampire which eats you.");
                    }
                }
                        
                else if (second.equals("living room"))
                {
                    System.out.println("You see a dog. Do you pet it?");
                    third = keyboard.next();
                
                    if (third.equals("yes"))
                    {
                        System.out.println("The dog bites your face off and you die.");
                    }
                    else if (third.equals("no"))
                    {
                        System.out.println("It gets mad that you ignore it and eats you.");
                    }
                }
            }
                        
            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 1