Assignemnt #77: A Text Adventure with Moveable Rooms

Code

 /// Name: Sean Harrison
    /// Period: 7
    /// Program name: Adventure2
    /// File Name: Adventure2.java
    /// Date Finished: 2/9/2015
    
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 awake in an abandoned building. Your clothes are damp and you have a headache, but you see a \"door\" leading to a room with large vats and \"stairwell\" leading to the roof. " );
            System.out.print( "> " );
            choice = keyboard.nextLine();
            if ( choice.equals( "door" ) )
                nextroom = 3;
                else if ( choice.equals("stairwell") )
                 nextroom = 2;
                else 
                System.out.println( " That is not an option please try again." );
            
            }
            if ( nextroom == 2 )
            {
                System.out.println( "You reach the top of the stairwell to discover that the door frame was long ago locked from the other side. A lockpick sure would be useful about now. you might as well go \"back\" ." );
                System.out.print( "> " );
                choice = keyboard.nextLine();
                if ( choice.equals( "back" ) )
                nextroom = 1;
                else
                    System.out.println( " That is not a good idea right now." );
            }
        if ( nextroom == 3 )
        {
            System.out.println( " You enter the vat room and see immense facilit with a catwalk with a lone \"corridor\" lurking overhead. There is also a drainage \"pitt\" that looks loose and you could probably pry off and climb into. " );
            choice = keyboard.nextLine();
        
        if (choice.equals ( "corridor" ) )
            nextroom = 1;
            else if (choice.equals("pitt") )
            nextroom = 4;
            else
            System.out.println( " That isn't currently an option. Try again " );
            
            }
        if ( nextroom == 4 )
        {
            System.out.println( " You remove the grate and set it aside " );
            System.out.println( " You drop down 5 feet into utter filth and runoff, a rat scampers by. " );
            System.out.println( " After crawling through the muck the drainage leads to the side of a hill outside the building. ");
            nextroom = 0;
        }
                
            
            }
            System.out.println( "\nYou are quite fortunate to have made it outside the building well done. " );
        }
    }
            
      
 

Picture of the output

Assignment 77