Assignment #45 and TinyAdventure
Code
/// Name: Jason Kim
/// Period: 7
/// Program Name: TinyAdventure
/// File Name: TinyAdventure.java
/// Date Finished:10/14/15
import java.util.Scanner;
public class TinyAdventure
{
public static void main (String[] args)
{
String choice1, choice2, choice3, choice4, choice5, choice6;
Scanner keyboard = new Scanner(System.in);
System.out.println("Welcome to Jason's Tiny Adventure!");
System.out.print("\nYou are in a strange house! It is raining outside. Would you like to go \"upstairs\" or into the \"kitchen\"? \n> ");
choice1 = keyboard.next();
System.out.println();
if( choice1.equals("upstairs"))
{
System.out.print("You tripped over on the stairs and hurt your arm! You are bleeding! Would you like to continue to go to the \"kitchen\" or go \"upstairs?\" \n> ");
choice2 = keyboard.next();
System.out.println();
if(choice2.equals("kitchen"))
{
System.out.print("You found a bandage in the kitchen! Do you want to use it?(\"yes\" or \"no\") \n> ");
choice3 = keyboard.next();
System.out.println();
if(choice3.equals("yes"))
{
System.out.println("The bandage was dirty. You die because you are infected.");
}
else
{
System.out.println("You bleed to death.");
}
}
else
{
System.out.print("You go upstairs. There whimpering sound is coming from the closet! Do you want to open the closet?(\"yes\" or \"no\")\n> ");
choice4 = keyboard.next();
System.out.println();
if(choice4.equals("yes"))
{
System.out.println("A crazy dog comes out and bites you. You die.");
}
else
{
System.out.println("Your dad suddenly bursts into the house. You go home.");
}
}
}
else
{
System.out.print("You try to go into the kitchen but the floor is really dirty. Do you want to \"jump\" or just \"ignore\" it?\n> ");
choice5 = keyboard.next();
System.out.println();
if( choice5.equals("ignore"))
{
System.out.print("You enter the kitchen with dirty feet. There is a cup that looks like water. Do you want to wash your feet with it? (\"yes\" or \"no\")\n> ");
choice6 = keyboard.next();
System.out.println();
if(choice6.equals("yes"))
{
System.out.println("The liquid was hydrochloric acid. You die with pain.");
}
else
{
System.out.println("You are infected by the germ and die.");
}
}
else
{
System.out.print("You jump, but get tripped over. The floor breaks with a loud sound, and you are in great pain. Suddenly, the door is clicking. Do you want to \"move\" or \"stay\"?\n> ");
choice6 = keyboard.next();
System.out.println();
if( choice6.equals("move"))
{
System.out.println("You try to move but you can't because of the intense pain. A man comes in and murders you.");
}
else
{
System.out.println("A man comes in and shoots you with a gun.");
}
}
}
}
}
Picture of the output