Prog77: Adventure 2
///Name: Ilana Levy
///Period: 5
///Program Name: Adventure 2
///File Name: Adventure2.java
///Date Finished: 10/13/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 = "";
System.out.println( "Welcome to the new fair grounds.");
while ( nextroom != 0 )
{
if ( nextroom == 1 )
{
System.out.println( "Where do you want to go first, to the \"ferris wheel\" or to the \"merry-go-round\"?" );
System.out.print( "> " );
choice = keyboard.nextLine();
if ( choice.equals("merry-go-round") )
nextroom = 2;
else if ( choice.equals("ferris wheel") )
nextroom = 3;
else
System.out.println( "ERROR." );
}
if ( nextroom == 2 )
{
System.out.println( "You feel kind of dizzy now but your friend offers you a greasy funnel cake. Do you accept, \"yes\" or \"no\"?" );
System.out.print( "> " );
choice = keyboard.nextLine();
if ( choice.equals("no") )
nextroom = 1;
else if ( choice.equals("yes") )
{
System.out.print( "You feel sick. You turn green. And then, you are captured by aliens who mistake you for one of their own." );
nextroom = 0;
}
else
System.out.println( "ERROR." );
}
else if ( nextroom == 3 )
{
System.out.println( "You go around and around, up and down. Suddenly, a really obnoxious couple gets in your cabin and starts making out. Do you \"get off\" the ride or do you \"push them off\"?" );
System.out.print( ">" );
choice = keyboard.nextLine();
if (choice.equals("get off"))
nextroom = 1;
else if ( choice.equals("push them off"))
nextroom = 4;
}
else if (nextroom == 4 )
{
System.out.println( "You run and try to hide.\nDo you go to the \"roller coaster\" or to the \"hall of mirrors\"?");
System.out.print( ">" );
choice = keyboard.nextLine();
if (choice.equals( "roller coaster" ) )
{
System.out.println( "You have a great time. The roller coaster is so much fun that you forget that you killed two people." );
nextroom = 5;
}
else if (choice.equals("hall of mirrors" ))
{
System.out.println("You dazzle the police and lose them. You escape out the back exit and go home." );
nextroom = 0;
}
}
else if ( nextroom == 5 )
{
System.out.println( "You see a clown. Do you run the other way, \"yes\" or \"no\"?" );
System.out.print( ">" );
choice = keyboard.nextLine();
if (choice.equals( "yes" ))
{
System.out.println( "You run to the other end of the park." );
nextroom = 4;
}
else if ( choice.equals( "yes" ))
{
System.out.println( "Of course you run, you idiot. You go to the last ride in the place." );
nextroom = 6 ;
}
}
else if ( nextroom == 6 )
{
System.out.println( "You stare at a creepy haunted house. Do you go in, \"yes\" or \"no\"?" );
System.out.println( ">" );
choice = keyboard.nextLine();
if (choice.equals( "yes" ) )
{
System.out.println( "Old man Davis chases you out for trespassing." );
nextroom = 3;
}
else if (choice.equals( "no" ) )
{
System.out.println( "your friends ridicule you as a coward. You live the rest of your life in shame." );
nextroom = 0;
}
}
}
System.out.println( "\nEND." );
}
}