Assignemnt #73 Short Adventure 2
Code
/// Name: JJ Deng
/// Period: 6
/// Program Name: Short Adventure 2
/// File Name: ShortAdventure2.java
/// Date Finished: 1/15/2016
import java.util.Scanner;
public class ShortAdventure2
{
public static void main( String[] args )
{
Scanner keyboard= new Scanner(System.in);
int room = 1;
String response = " ";
while (room!= 0)
{
if (room == 1)
{
System.out.println(" Your in front of ghost house would you rather go in or run away");
System.out.print(">");
response = keyboard.next();
if (response.equals("go"))
room = 2;
else if( response.equals("run"))
room = 3;
}
if (room == 2)
{
System.out.println("You went in the ghost house and you realized this is not any ordinary ghost house, its a house full of actual ghosts and then you see a white creature approaching you what do you do, fight with your knife or go into a door thats next to you, or say hi to him frendly ");
System.out.print(">");
response = keyboard.next();
if (response.equals("door"))
room = 4;
else if( response.equals("fight"))
room = 5;
else if( response.equals("hi"))
room = 6;
}
if (room == 3)
{
System.out.println(" you got out and u ran hella hard as fast as possible soon you see a dude with a creepy black hat, and his walking towards you slowly, what would you do right now? say hi and stand there or grab out your pocketknife and stab him");
System.out.print(">");
response = keyboard.next();
if (response.equals("hi"))
room = 6;
else if( response.equals("stab"))
room = 5;
}
if (room == 4)
{
System.out.println(" You quickly hid inside the door you opened and then you realized there is only a window in this room and nothing else, would you jump out of the window or fight the white creature.");
System.out.print(">");
response = keyboard.next();
if (response.equals("fight"))
room = 5;
else if( response.equals("window"))
room = 3;
}
if (room == 5)
{
System.out.println(" You pulled out your knife and stabbed the him and you've realized that it's a person, do you call 911 or just leave him there");
System.out.print(">");
response = keyboard.next();
if (response.equals("911"))
room = 6;
else if( response.equals("leave"))
room = 7;
}
if (room == 6)
{
System.out.println("cuz ur nice u lived" );
room = 0;
}
if (room == 7)
{
System.out.println(" cuz ur mean u dead" );
room = 0;
}
}
}
}
Picture of the output