Assignment 77, Short Adventure 2: With a Loop

Code

   ///Name: Stella Koliavas
   ///Period: 5
   ///File Name: Ad2.java
   ///Date Finshed: 2/9/16
   
  import java.util.Scanner;

public class Ad2
{
	public static void main( String[] args )
	{
		Scanner siri = new Scanner(System.in);
		
		int nextroom = 1;
		String choice = " ", x;

		while ( nextroom != 0 )
		{
			if ( nextroom == 1 )
			{
				System.out.println( "You are a dumb child and enter what is rumored
				to be a very haunted house. Alone. You kick open the half stuck, 
				and dilapitated wooden door and come into a small foyer with an adjacent
				\"kitchen\" and some stairs leading to the \"basement\". Where would 
				you like to go?" );
				System.out.print( "> " );
				choice = siri.nextLine();
				if ( choice.equals("kitchen") )
					nextroom = 2;
				else if ( choice.equals("basement") )
					nextroom = 3;
				else
					System.out.println( "ERROR." );
			}
			
            if ( nextroom == 2 )
			{
				System.out.println( "You walk past the raggedy sofa and into an 
				even older 50's style kitchen. You can either go \"outside\" or
				go  back to the \"foyer\". Where would you like to go?" );
				System.out.print( "> " );
				choice = siri.nextLine();
				if ( choice.equals("foyer") )
					nextroom = 1;
                else if ( choice.equals("outside") )
                    nextroom = 4;
				else
					System.out.println( "ERROR." );
            }
                
            if ( nextroom == 3 )
			{
				System.out.println( "You walk down the creaking stairs and you fall 
				through. Luckly you land on something soft but it smells weird. You look
				down you find out you land on a bunch of bodies and there's a sewage
				tunnel with a blood trail leading into it. Do you follow the \"blood\" 
				or do you \"call\" 911 and report all the dead, decaying bodies?" );
        System.out.print( "> " );
				choice = siri.nextLine();
				if ( choice.equals("blood") )
					nextroom = 5;
                if ( choice.equals("call") )
                {
                    System.out.println( "You call 911 only to get no answer. You
                    go to redial when you begin to hear rustling and snaring sounds.
                    You begin to run back up the broken stairs when something 
                    supernatural throws you against the wall and you die from loss
                    of blood. GAME OVER.");
                nextroom = 0;
                }
            }
                
            if ( nextroom == 4 )
			{
                nextroom = 0;
				System.out.println( "You walk through the kitchen and open a half broken 
				sliding glass door. You push it open and it shatters, a big chunk falling 
				into your foot because you're stupid and wore flips flops on an 
				adventure. The glass is now blocking your entrance back into the house and
				you have no option other than to go forward into the dead, tall grass. You 
				trip immediately and cut your leg on rusted iron. Shit you think 
				because you never got your tetnus shot. You died 3 days later. " );
            }
           
            if ( nextroom == 5 )
			{
				System.out.println( "You pull out your iphone and turn on the flashlight. You
				see odd, satanic writing on the walls but being stupid, you continue to go down 
				the sewage tunnel. You come to a fork in the tunnel. Do you go \"left\" or 
				\"right\"?");
				System.out.print( "> " );
				choice = siri.nextLine();
				if ( choice.equals("left") )
                {
                    nextroom = 0;
					System.out.println( "You turn a hard left and come to an odd mirror. Curiously 
					you look into the mirror only to see a deranged killer staring at you and 
					mimicking your every move. You run away, unsure if the stranger in the mirror 
					is you.");
                }
                if ( choice.equals("right") )
                {
                    nextroom = 0;
                    System.out.println( "You turn a hard right and walk right into an
                    alligator. He introduces himself in rather upbeat voice as Bob, 
                    and then bores you with his life story. When he starts to see you're
                    bored he gets angry and eats you alive. GAME OVER.") ;
                }
            }
            
			}
            System.out.println( "\nEND." );
        }
	}
	


        
    

Picture of the output

Assignment 77