Project #1

Code

    /// Name: Ian Stanko
    /// Period: 5
    /// Program Name: BigAdventure
    /// File Name: BigAdventure.java
    /// Date Finished: 11/15/2015
    
  import java.util.*;
    
    public class BigAdventure
    {
        public static void main ( String[] args )
        {
               String q1, q2, q3;
                    
                Scanner keyboard = new Scanner(System.in);
                
                System.out.println("");
                System.out.println("Welcome to My Longer Adventure Game!");
             
                System.out.println("");
                System.out.println("You are in a creepy house! Would you like to go upstairs, into the basement, or into the kitchen??"); //upstairs, basement, kitchen
                System.out.print("> ");
                q1 = keyboard.next();
                System.out.println("");
                
                if (q1.equals("upstairs"))
                {
                    System.out.println("Upstairs you see a hallway.  At the end of the hallway is the master \"bedroom\". There is also a \"bathroom\" off the hallway.  Where would you like to go?"); //bed or bath
                    System.out.print("> ");
                    q2 = keyboard.next();
                    System.out.println("");
                    
                    if (q2.equals("bedroom"))
                    {
                        System.out.println("You are in a plush bedroom, with expensive-looking hardwood furniture.  The bed is unmade.  In the back of the room, the closet door is ajar.  Would you like to open the door?"); //yes or no
                        System.out.print("> ");
                        q3 = keyboard.next();
                        System.out.println("");
                        
                        if (q3.equals("yes"))
                        {
                            System.out.println("There is a monster in the closet, you get eaten"); //ENDING ONE
                        }
                        
                        else if (q3.equals("no"))
                        {
                            System.out.println("The all doors suddenly close and lock, you are trapped."); //ENDING TWO
                        }
        
                        else
                        {
                            System.out.println("ERROR: You did not chose one of the options provided");
                        }
                                        
                    }
                    
                    else if (q2.equals("bathroom"))
                    {
                        System.out.println("In the bathroom there is a shower curtain, do you pull it back to reveal what's behind it?");
                        System.out.print("> ");
                        q3 = keyboard.next();
                        System.out.println("");
                        
                        if (q3.equals("yes"))
                        {
                            System.out.println("There is a serial killer waiting for you the other side, OOPS!");  //ENDING THREE
                        }
        
                        else if (q3.equals("no"))
                        {
                            System.out.println("You back out slowly and get lost in the house."); //ENDING FOUR
                        }
                        
                        else
                        {
                            System.out.println("ERROR: You did not chose one of the options provided");
                        }
                    }
        
                    else
                    {
                        System.out.println("ERROR: You did not chose one of the options provided");
                    }
                }
                
                else if (q1.equals("basement"))
                {
                    System.out.println("You reach the bottom of the stairs, there are two options, flick the \"switch\" to turn on the light or use an old oil \"lamp\" sitting at the bottom of the stairs?");
                    System.out.print("> ");
                    q2 = keyboard.next();
                    System.out.println("");
                    
                    if (q2.equals("switch"))
                    {
                        System.out.println("The switch turns on the light but also opens a secred door in the wall. Do you go through it?");
                        System.out.print("> ");
                        q3 = keyboard.next();
                        System.out.println("");
                        
                        if (q3.equals("yes"))
                        {
                            System.out.println("The door closes behind you, water starts flooding in, YOU ARE TRAPPED!!"); //ENDING FIVE
                        }
                        
                        else if (q3.equals("no"))
                        {
                            System.out.println("The door quickly closes, the lights turn off, you are lost in the basement."); //ENDING SIX
                        }
                        
                        else
                        {
                            System.out.println("ERROR: You did not chose one of the options provided");
                        }
                        
                    }
        
                    else if (q2.equals("lamp"))
                    {
                        System.out.println("You look around the basement and find a a lever on the wall and a torch placed on the wall. Do you light the \"torch\" with the lamp or pull the \"lever\" ?");
                        System.out.print("> ");
                        q3 = keyboard.next();
                        System.out.println("");
                        
                        if (q3.equals("torch"))
                        {
                            System.out.println("A stone wall lifts to reveal a tunnel outside, YOU ARE FREE!!"); //ENDING SEVEN
                        }
                        
                        else if (q3.equals("lever"))
                        {
                            System.out.println("A trap door opens under you, you fall."); //ENDING EIGHT
                        }
                        
                        else
                        {
                            System.out.println("ERROR: You did not chose one of the options provided");
                        }           
                    }
                    
                    else
                    {
                       System.out.println("ERROR: You did not chose one of the options provided");
                    }
                }
                
                else if (q1.equals("kitchen"))
                {
                    System.out.println("There is a long countertop with dirty dishes everywhere. Off to one side there is, as you'd expect, a refrigerator. You may open the refrigerator or look in a cabinet");
                    System.out.print("> ");
                    q2 = keyboard.next();
                    System.out.println("");
                    
                    if (q2.equals("refrigerator"))
                    {
                        System.out.println("Inside the refrigerator you see food and stuff.  It looks pretty nasty. Would you like to eat some of the food? (\"yes\" or \"no\")");
                        System.out.print("> ");
                        q3 = keyboard.next();
                        System.out.println("");
                        
                        if (q3. equals("yes"))
                        {
                            System.out.println("You get sick and die... eventually"); //ENDING NINE
                        }
                        
                        else if (q3.equals("no"))
                        {
                            System.out.println("You die of starvation... eventually."); //ENDING TEN
                        }
                        
                        else 
                        {
                            System.out.println("ERROR: You did not chose one of the options provided");
                        }
                    }
                    
                    else if (q2.equals("cabinet"))
                    {
                        System.out.println("You find a tunnel on the other side. Do you go through it? (\"yes\" or \"no\")");
                        System.out.print("> ");
                        q3 = keyboard.next();
                        System.out.println("");
                        
                        if (q3.equals("yes"))
                        {
                            System.out.println("You found the tunnel to Narnia, you are the new ruler");
                        }
                        
                        else if (q3.equals("no"))
                        {
                            System.out.println("The tunnel eventualy closes, you are lost in the house.");
                        }
                        
                        else
                        {
                            System.out.println("ERROR: You did not chose one of the options provided");
                        }
                    }               
                }
                
                else
                {
                    System.out.println("ERROR: You did not chose one of the options provided");
                }
            
            
            
            
            System.out.println();
            System.out.println("THANKS FOR PLAYING!!!");
            
            
        }
    }

    

Picture of the output

Project 1