Assignment # P1 and Longer Adventure

Code

    /// Name: Tommy Oyuntseren
    /// Period: 7
    /// Program Name: LongerAdventure
    /// File Name: LongerAdventure.java
    /// Date: 3/4/2016

import java.util.Scanner;

public class LongerAdventure
{
    public static void main(String [] args)
    {
        String ans1, ans2, ans3, ans4, ans5, ans6, ans7, ans8, ans9, ans10;
        
        Scanner keyboard=new Scanner(System.in);
        
        System.out.println("Welcome to your own adventure!");
        
        System.out.println();
        
        System.out.println("You enter a vacant haunted house in the middle of the night. The door closes and locks behind you. Do you go to the \"living room\", go \"upstairs\", or go into the \"garage\"?");
        System.out.print("> ");
        ans1=keyboard.next();
        
        System.out.println();
        
        if (ans1.equals("living room"))
        {
            System.out.println("As you're walking into the living room you notice a dog sniffing around and a journal on the coffee table. Do you go to the \"dog\" to see what he is sniffing or read the \"journal\"?");
            System.out.print("> ");
            ans2=keyboard.next();
            
            System.out.println();
            
            if (ans2.equals("dog"))
            {
                System.out.println("The dog starts scratching at a closet door. Do you open the door? (\"yes\" or \"no\")");
                System.out.print("> ");
                ans3=keyboard.next();
                
                System.out.println();
                
                if (ans3.equals("yes"))
                    {
                    //ENDING 1
                    System.out.println("A killer is in there and you die.");
                    }
                else //no
                {
                    //ENDING 2
                    System.out.println("You're left curious and just play with the dog.");
                }
            }
            
            else //journal
            {
                System.out.println("You read a journal entry dated from yesterday. Knowing the house has been vacant for months. Do you keep \"reading\" or go into the \"kitchen\"?");
                System.out.print("> ");
                ans4=keyboard.next();
                
                System.out.println();
                
                if (ans4.equals("reading"))
                    {
                        //ENDING 3
                        System.out.println("You spend the whole night reading about the person who secretly lives in the house.");
                    }
                else //kitchen
                    {
                        //ENDING 4
                        System.out.println("You find fresh soup on the stove. You go to smell it as a knock comes from the front door...");
            }
                    
            
            }
        }
        
        else if (ans1.equals("garage"))
        {
            System.out.println("You walk in through the garage door and notice some boxes on the side and a new looking car parked. Do you check out the \"boxes\" or go into the \"car\"?");
            System.out.print("> ");
            ans8=keyboard.next();
            
            System.out.println();
            
            if (ans8.equals("boxes"))
            {
                System.out.println("As you walk towards the boxes you notice they are are covered in dust. Do you open the \"big\" box or the \"small\" box?");
                System.out.print("> ");
                ans9=keyboard.next();
                
                System.out.println();
                
                if (ans9.equals("big"))
                    {
                    //ENDING 9
                    System.out.println("There's nothing in the big box just some crumpled paper. You leave through the open garage door.");
                    }
                else //small
                {
                    //ENDING 10
                    System.out.println("There are some old photographs of a happy family in the small box. You're looking through them and suddenly hear footsteps upstairs.");
                }
            }
            
            else //car
            {
                System.out.println("You notice a ring of keys on the seat as you go to sit in the car. Do you \"drive\" the car out the open garage door or \"look\" around inside the car\"?");
                System.out.print("> ");
                ans10=keyboard.next();
                
                System.out.println();
                
                if (ans10.equals("drive"))
                    {
                        //ENDING 11
                        System.out.println("You drive away with a new stolen car.");
                    }
                else //look
                    {
                        //ENDING 12
                        System.out.println("You begin to look around the backseat and lock eyes with a small knife. At that exact moment you hear a door slam shut.");
                    }
            }
        }
        
        else //upstairs
        {
            System.out.println("You hear a door creak down the hall way. Do you go \"towards\" the sound or \"away\" from it?");
            System.out.print("> ");
            ans5=keyboard.next();
            
            System.out.println();
            
            if (ans5.equals("towards"))
            {
                System.out.println("You reach the last door but it's locked. Do you \"break\" the door handle or go into \"another room\"?");
                System.out.print("> ");
                ans6=keyboard.next();
                
                System.out.println();
                
                if (ans6.equals("break"))
                {
                    //ENDING 5
                    System.out.println("You go in and find nothing. The window was open. You found a way out.");
                }
                else //another room
                {
                    //ENDING 6
                    System.out.println("You walk in to find a box with jewels with a note saying \"to the finder of this box.\"");
                }
            }
            else // away
            {
                System.out.println("You walk down the hall where there is a bathroom and the entrance to the attic. Do you enter the \"bathroom\" or the \"attic\"?");
                System.out.print("> ");
                ans7=keyboard.next();
                
                System.out.println();
                
                if (ans7.equals("bathroom"))
                {
                    //ENDING 7
                    System.out.println("You walk into the bathroom with a window you could probably fit through. You escaped.");
                }
                else //attic
                {
                    //ENDING 8
                    System.out.println("You take a step into the attic and the attic door closes behind you leaving you in complete darkness...");
                }
            }
        }
        
        System.out.println();
        System.out.println("Thanks for playing!");
    }
}
  

  

Picture of the output

Assignment P1