Assignemnt #45
Code
/// Name: Connor Siri
/// Period: 7
/// Program Name: Choose
/// File Name: Choose.java
/// Date Finished: 10/14/2015
import java.util.Scanner;
class Choose{
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
String a, s, d, f, g, h, j;
System.out.println("");
System.out.println("");
System.out.println("");
System.out.println("");
System.out.println(" Welcome to the play house");
System.out.println("Let's have some fun");
System.out.println("You are in the play house and there are stairs, do you go (up or stay)");
System.out.print("> ");
a = keyboard.next();
System.out.println("");
if (a.equals("up"))
{
System.out.println("When you go up the stairs you notice two doors do you go (left or right)");
System.out.print("> ");
s = keyboard.next();
System.out.println("");
if (s.equals("left"))
{
System.out.println("You open the door and notice a box do you (open_it or leave_it)");
System.out.print("> ");
d = keyboard.next();
System.out.println("");
if ( d.equals("open_it"))
{
System.out.println("The box exploded and you died!");
}
else if (d.equals("leave_it"))
{
System.out.println("The weak floor broke while you stood there and you fell to your death");
}
}
else if (s.equals("right"))
{
System.out.println("You open the door and notice a mirror maze, do you (enter or stay)");
System.out.print("> ");
j = keyboard.next();
System.out.println("");
if (j.equals("enter"))
{
System.out.println("You enter the maze, get lost and die of starvation!");
}
else if (j.equals("stay"))
{
System.out.println("As you stand infront of the maze the evil clown sneaks up behind you and kills you.");
}
}
}
else if (a.equals("stay"))
{
System.out.println("You go past the stairs and notice a hatch in the ground and a door, do you open the (hatch or door)");
System.out.print("> ");
f = keyboard.next();
System.out.println("");
if (f.equals("hatch"))
{
System.out.println("You go down the hatch and enter a small room with a clown sleeping, do you either(kill or wake) the clown.");
System.out.print("> ");
g = keyboard.next();
System.out.println("");
if (g.equals("kill"))
{
System.out.println("The clown was fake and the real one creeped up on you and killed you");
}
else if (g.equals("wake"))
{
System.out.println("The clown woke up and trapped you in a cage where you starved to death");
}
}
else if (f.equals("door"))
{
System.out.println("You walk into a room with a table full of food, do you (eat or leave) the food");
System.out.print("> ");
h = keyboard.next();
System.out.println("");
if (h.equals("eat"))
{
System.out.println("You eat the food, but it was poisoned so you die");
}
else if (h.equals("leave"))
{
System.out.println("You leave the house, walk to the road, and get hit by a passing car. You died.");
}
}
}
else
{
System.out.println("You didn't play the game so you died.");
}
System.out.println("");
System.out.println("Don't go into creepy play houses");
}
}
Picture of the output