Assignemnt #77

Code

          /// Name: Holden Ganch
          /// Period: 7
          /// Program Name:  seventy seventh Program
          /// File Name: Baby.java
          /// Date Finished: 2/10/2016


    
        
           import java.util.Scanner;

          public class Adventure2
          {
          	public static void main( String[] args )
          	{
          		Scanner keyboard = new Scanner(System.in);
          		
          		int nextroom = 1;
          		String choice = "";
          
          		while ( nextroom != 0 )
          		{
          			if ( nextroom == 1 )
          			{
          				System.out.println( "You are in a small room. There is a \"closet\" and a doorway to the \"hall\"." );
          				System.out.print( "Where will you go? > " );
          				choice = keyboard.nextLine();
          				if ( choice.equals("closet") )
          					nextroom = 2;
          				else if ( choice.equals("hall") )
          					nextroom = 3;
          				else
          					System.out.println( choice + " That wasn't one of the options. Try again." );
          			}
          			if ( nextroom == 2 )
          			{
          				System.out.println( "Aww too bad the cloest is empty, you have to turn around and go \"back\"." );
          				System.out.print( "> " );
          				choice = keyboard.nextLine();
          				if ( choice.equals("back") )
          					nextroom = 1;
          				else
          					System.out.println( choice + " That wasn't one of the options. Try again." );
          			}
          			if ( nextroom == 3 )
          			{
          				System.out.println( "You are in the hallway and notice that their is a basement.\n do you go \"in\" or do you continue \"Down\" the hall" );
          				
          				choice = keyboard.nextLine();
          				System.out.print( "> " );
          				if ( choice.equals("in") )
          					nextroom = 1;
          				else if ( choice.equals("down") )
          					nextroom = 4;
          				else
          					System.out.println( choice + " wasn't one of the options. Try again." );
          			}
          			if ( nextroom == 4 )
          			{
          				System.out.println( "You go to the end of the hall and see a door on each side and a hole.\n Do you go \"left\" , \"right\" , or \"jump\" into the hole" );
                          choice = keyboard.nextLine();
          				System.out.print( "> " );
          				if ( choice.equals("left") )
          					nextroom = 1;
          				else if ( choice.equals("right") )
          					nextroom = 5;
                              else if ( choice.equals("jump") )
          					nextroom = 8;
          				else
          					System.out.println( choice + " wasn't one of the options. Try again." );
          			}
          			if ( nextroom == 5 )
          			{
          				System.out.println( "You enter a room with a mirror and a ladder. Do you go up the \"ladder\" or do you go to the \"mirror\" " );
                          choice = keyboard.nextLine();
          				System.out.print( "> " );
          				if ( choice.equals("ladder") )
          					nextroom = 1;
          				else if ( choice.equals("mirror") )
          					nextroom = 6;
          				else
          					System.out.println( choice + " wasn't one of the options. Try again." );
          			}	
                      if ( nextroom == 6 )
          			{
          				System.out.println( "You walk up to the mirror and it moves like liquid. Do you \"touch\" the mirror or do you run \"away\" " );
                          choice = keyboard.nextLine();
          				System.out.print( "> " );
          				if ( choice.equals("away") )
          					nextroom = 2;
          				else if ( choice.equals("touch") )
          					nextroom = 7;
          				else
          					System.out.println( choice + " wasn't one of the options. Try again." );
          			}	
                      if ( nextroom == 7 )
          			{
          				System.out.println( "The mirror liquid grabs your hand and pulls you in and you wake up from your dream" );
                          System.out.println("");
                         nextroom = 0;
          			}	
                      if ( nextroom == 8 )
          			{
          				System.out.println( "You jump into the hole and get impaled by spikes.\n You are found in your bed with a hole in your chest but nothing sticking out" );
                          System.out.println("");
                         nextroom = 0;
          			}	
          			}
          				
          		
          
          		System.out.println( "\nSometimes Your dreams are real" );
              
          	}
          	
          }

    
   




    

Picture of the output

Assignment 77