Assignment #45 and Choose Your Own Adventure

Code

    /// Name: Ali Kurland
    /// Period: 6
    /// Program Name: Choose Your Own Adventure
    /// File Name: ChooseYourOwn.java
    /// Date Finished: 9/29/2015
    
    import java.util.Scanner;
    
    public class ChooseYourOwn
    {
        public static void main( String[] args )
        {
            Scanner keyboard = new Scanner(System.in);
            
            String answer1, answer2, answer3, answer4, answer5, answer6, answer7;
            answer2 = " ";
            
            System.out.println( "WELCOME TO CHOOSE YOUR OWN ADVENTURE!" );
            System.out.println( " " );
    
            System.out.println( "One day, you are walking through the forest when you come to two pathways: one leading to the \"left\" and one to the \"right\". Which path would you like to take?" );
            System.out.print( "> " );
            answer1 = keyboard.next();
          
            if ( answer1.equals("left") )
            {
                System.out.println( "After  walking along the path for while, the trail splits again. A sign indicates that one path leads to the \"city\" and the other leads to the \"lake\". Where would you like to go?" );
                System.out.print( "> " );
                answer2 = keyboard.next();
            if ( answer2.equals("city") )
            {
                System.out.println( "Eventually, you arrive in the city. There is so much to do! You're a little hungry, but you also want to see the sights. Would you prefer to \"eat\" or \"sightsee\"?" );
                System.out.print( "> " );
                answer3 = keyboard.next();
            if ( answer3.equals("eat") )
            {
                System.out.println( "You go to a nice restaurant in the middle of town and have a lovely meal. As you leave the restaurant, the sun is setting and you realize that it is time for you to head home. Thanks for playing!" );
            }
            else 
            {
                System.out.println( "You spend your day taking in the sights of the city. After a fun-filled day of exploration, you go back home. Thanks for playing!" );
            }
            }
            else 
            {
                System.out.println( "Eventually, you arrive at a large, clear lake. Looking around, you notice a fishing pole, and an old tire swing. You can either go\"fishing\" or \"swing\"." );
                System.out.print( "> " );
                answer4 = keyboard.next();
            if ( answer4.equals("fishing") )
            {
                System.out.println( "You grab the fishing pole and head to the dock. You spend a few hours fishing, but don't catch anything. Slightly disappointed, you return home. Thanks for playing!" ); 
            }
            else
            {
                System.out.println( "You decide to try out the tire swing. Unfortunately, it breaks and you fall into the lake. Luckily, you're a strong swimmer! You get out of the lake and dry off in the sun for a while. Then, you return home. Thanks for playing!" );
            }
            }
            }
            
            
            else
            {
                System.out.println( "You head to the right. Eventually, you come to another split in the trail. There a two signs; one advertises a carnival. The other is very old, and the label has worn off. Would you like to go to the \"carnival\" or try your luck with the \"mystery\" path?" );
                System.out.print( "> " );
                answer5 = keyboard.next();
            if ( answer5.equals("carnival") )
            {
                System.out.println( "You arrive at the carnival. There's so much to do! Would you prefer to ride the \"ferris wheel\" or play a \"game\"?" );
                System.out.print( "> " );
                answer6 = keyboard.next();
            if ( answer6.equals("ferris wheel") )
            {
                System.out.println( "You buy a ticket and go on the ferris wheel! Unfortunately, you get stuck at the top of the ride for a while... at least there's a nice view! Thanks for playing!" );
            }
            else 
            {
                System.out.println( "You head to the nearest game booth. It's darts! You're not too bad at this, and manage to win a goldfish! After spending the rest of the day at the carnival, you head home with your new pet. Thanks for playing!" );
            }
            }
            else 
            {
                System.out.println( "You travel along the mystery path, curious to see where it leads. After walking for a very long time, you realize that the trail ends in the middle of the forest! You can either continue exploring \"off-trail\" or \"go back\"." );
                System.out.print( "> " );
                answer7 = keyboard.next();
            if ( answer7.equals("off-trail") )
            {
                System.out.println( "You navigate through the trees and plants and unfortunately get lost! At least it's very peaceful out here. Eventually, you find your way back to the path and return home. Thanks for playing!" ); 
            }
            else
            {
                System.out.println( "You decide it's better to stay on the path, and decide to go back. A little bored but glad you didn't get lost, you walk home at a leisurely pace. Thanks for playing!" );
            }
            }
            }
        }
    }
    

Picture of the output

Assignment 45