Assignemnt #77

Code

///colin hinton
///5th period
///Adventure
///Adventure.java
///11/18/2015

import java.util.Scanner;

public class Adventure
{
	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 at hotel. There is the \"loby\" and a doorway to the \"theater\"." );
				System.out.print( "> " );
				choice = keyboard.nextLine();
				if ( choice.equals("loby") )
					nextroom = 2;
				else if ( choice.equals("theater") )
					nextroom = 3;
				else
					System.out.println( " You failed the easiest of tasks" );
			}
			if ( nextroom == 2 )
			{
				System.out.println( "You go to the lobby and there is a shady man standing there, you can \"talk\" to him," );
                System.out.println( "You could also be violent and \"attack\" the man, or just leave and go \"back\" ");
				System.out.print( "> " );
				choice = keyboard.nextLine();
				if ( choice.equals("back") )
					nextroom = 1;
                else if ( choice.equals("talk"))
                    nextroom = 5;
                else if ( choice.equals("attack"))
                    nextroom = 6;
                else
					System.out.println( choice + " wasn't one of the options. Try again." );
			}
			if ( nextroom == 3 )
			{
				System.out.println( "You enter the theater and notice a dark figure around the green room" );
				System.out.println( "do you \"follow\" it or just go \"back\" " );
				choice = keyboard.nextLine();
				System.out.print( "> " );
				if ( choice.equals("back") )
					nextroom = 1;
				else if ( choice.equals("follow") )
					nextroom = 4;
				else
					System.out.println( choice + " wasn't one of the options. Try again." );
			}
			if ( nextroom == 4 )
			{
				System.out.println( "while following the figure you fall into the floor and perish" );
				System.out.println();
				nextroom = 0;
			}
            if ( nextroom == 5)
            {
                System.out.println("You try to talk to the man but he goes into another room");
                System.out.println("Now that you confront him he takes off his shirt and challenges you to a dance off");
                System.out.println("You win the dance off and take all of his pride");
                nextroom = 0;
		    }	
            if ( nextroom == 6)
            {
                System.out.println("You FOOL, you try to fight him but this game is broken.");
                System.out.println("BACK TO THE START AHAHAHAHAHAHA");
                nextroom = 1;
            }
         }
        System.out.println("GAME OVER");
	}
}


    

Picture of the output

Assignment 1