Assignment #77 and Adventure 2
Code
///John Mulligan
///period 5
///Program Name: Adventure2
///File Name: Adventure2.java
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 wake up in a pod. There is an \"shiny red button\" and a hatch marked with the sign \"lauch bay\"." );
System.out.print( "> " );
choice = keyboard.nextLine();
if ( choice.equals("shiny red button") )
nextroom = 2;
else if ( choice.equals("launch bay") )
nextroom = 3;
else
System.out.println( choice + " not a choice buddy }:/ . Try again." );
}
if ( nextroom == 2 )
{
System.out.println( "You hit the red button because you havent seen any movie ever. Nothing happens so you \"rethink\"." );
System.out.print( "> " );
choice = keyboard.nextLine();
if ( choice.equals("rethink") )
nextroom = 1;
else
System.out.println( choice + " not an option :/. Try again!" );
}
if ( nextroom == 3 )
{
System.out.println( "You open the hatch. to your suprise, you hear the red button beep to infering you need to go back to the " );
System.out.println( "\"pod\" BUT!, you could adventure further" );
System.out.println( "Do you want to enter the \"pod\" or adventure \"further\" see whats going on." );
choice = keyboard.nextLine();
System.out.print( "> " );
if ( choice.equals("pod") )
nextroom = 1;
else if ( choice.equals("further") )
nextroom = 4;
else
System.out.println( choice + " thats no choice. Try again." );
}
if ( nextroom == 4 )
{
System.out.println( "You see a window and look out to see earth." );
System.out.println( "you enter the pod and everything goes dark. You and the pod plumit tword the earth" );
nextroom = 0;
}
}
System.out.println( "\Thank you for playing :D" );
}
}