Project

Code

    /// Name: Kabir Virk
    /// Period: 6
    /// Program Name: Choose Your Own Slightly Longer Adventure!
    /// File Name: LongAdventure.java
    /// Date Finished: 11/30/2015
    
    import java.util.Scanner;

public class LongAdventure
{
    public static void main(String[] args)
    {
        Scanner keyboard = new Scanner(System.in);
        
        String choiceA, choiceA1, choiceA1a, choiceA1b, choiceA2, choiceA2a, choiceA2b, choiceA3, choiceA3a, choiceA3b;
        
        System.out.println("LET'S BEGIN YOUR ADVENTURE!");
        System.out.println();
        
        System.out.println("You wake up on an island. You can either go towards the \"jungle\", \"ocean\", or into a \"cave\"?");
        choiceA = keyboard.next();
        System.out.println();
        
        if (choiceA.equals("jungle"))
        {
            System.out.println("You go into the jungle and see a sign. You can go either \"left\" or \"right\".");
            choiceA1 = keyboard.next();
            System.out.println();
            
            if (choiceA1.equals("left"))
            {
                System.out.println("You encounter a snake on your way. Do want to continue down this path? (\"yes\" or \"no\")");
                choiceA1a = keyboard.next();
                System.out.println();
                
                if (choiceA1a.equals("yes"))
                {
                    System.out.println("You try to sneak past the snake but he attacks you and kills you.");
                }
                
                else if (choiceA1a.equals("no"))
                {
                    System.out.println("You try to go back to the beach but cant find your way and die!.");
                }
                
                else
                    System.out.println("That is not a destination.");
            }
            
            else if (choiceA1.equals("right"))
            {
                System.out.println("You find a guy playing the drums. Do you want to play with him? (\"yes\" or \"no\")");
                choiceA1b = keyboard.next();
                System.out.println();
                
                if (choiceA1b.equals("yes"))
                {
                    System.out.println("You become a master drummer and conquer the drumming world.");
                }
                
                else if (choiceA1b.equals("no"))
                {
                    System.out.println("You You try to go back to the beach but cant find your way and die!");
                }
                
                else
                    System.out.println("That is not a destination.");
            }
            
            else
                System.out.println("That is not a destination.");
        }
        
        else if (choiceA.equals("ocean"))
        {
            System.out.println("You enter the ocean with scuba gear and see some sharks. Do you want to go to the \"sharks\" or \"deeper\"?");
            choiceA2 = keyboard.next();
            System.out.println();
            
            if (choiceA2 == "sharks")
            {
                System.out.println("As you approach the sharks, you notice they seem friendly,would you like to introduce yourself? (\"yes\" or \"no\")");
                choiceA2a = keyboard.next();
                System.out.println();
                
                if (choiceA2a.equals("yes"))
                {
                   System.out.println("You say hello to the sharks, but they take this as a hostile greeting since they dont understand english and attack you!"); 
                }
                
                else if (choiceA2a.equals("no"))
                {
                    System.out.println("You continue on your way towards the ocean.");
                }
                
                else
                    System.out.println("That is not a destination.");
            }
            
            else if (choiceA2.equals("deeper"))
            {
                System.out.println("You keep swimming, you check your oxygen levels to make sure they are good. You see they are halfway, would you like to continue? (\"yes\" or \"no\")");
                choiceA2b = keyboard.next();
                System.out.println();
                
                if (choiceA2b.equals("yes"))
                {
                    System.out.println("You keep swimming until you find a strange rock, you touch it and become a fish for the rest of your life.");
                }
                
                else if (choiceA2b.equals("no"))
                {
                    System.out.println("You swim back to land to live another day.");
                }
                
                else
                    System.out.println("That is not a destination.");
            }
            
            else
                System.out.println("That is not a destination.");
        }
        
        else if (choiceA.equals("cave"))
        {
            System.out.println("You find a cave nearby and think about going inside or checking around to make sure. Do you want to go \"inside\" or \"outside\"?");
            choiceA3 = keyboard.next();
            System.out.println();
            
            if (choiceA3.equals("inside"))
            {
               System.out.println("You enter the cave to find a TV. Would you like to watch? (\"yes\" or \"no\")"); 
                choiceA3a = keyboard.next();
                System.out.println();
                
                if (choiceA3a.equals("yes"))
                {
                    System.out.println("You watch tv until you die.");
                }
                
                else if (choiceA3a.equals("no"))
                {
                    System.out.println("You look at the TV even though it is off.");
                }
                
                else
                    System.out.println("That is not a destination.");
            }
            
            else if (choiceA3 == "outside")
            {
                System.out.println("You walk around the cave and find another entrance. Do you go in? (\"yes\" or \"no\")");
                choiceA3b = keyboard.next();
                System.out.println();
                
                if (choiceA3b.equals("yes"))
                {
                    System.out.println("You go in and find a giant TV and watch it until you die.");
                }
                
                else if (choiceA3b.equals("no"))
                {
                    System.out.println("You continue walking past the cave until you meet bears and they eat you.");
                }
                
                else
                    System.out.println("That is not a destination.");
            }
            
            else
                System.out.println("That is not a destination.");
        }
        
        else
            System.out.println("That is not a destination.");
    }
}
 

Picture of the output

Project