Project #1 and Choose your own slightly longer adventure
Code
///Name: Tim Gibson
///Period: 6
///Project Name: Choose your Own Slightly Longer Adventure
///File Name: CYOA2.java
///Date Finished: 10/14/15
import java.util.Scanner;
public class CYOA2
{
public static void main ( String[] args )
{
Scanner keyboard = new Scanner(System.in);
String r2, r3, r5, r6;
System.out.println( "WELCOME TO TIMMY'S TINY ADVENTURE!" );
System.out.println( "\nYou are in a creepy house on a dark and stormy night. Would you like to go \"upstairs\", into the \"basement\", or into the \"parlor\"?" );
r2 = keyboard.next();
if ( r2.equals("upstairs"))
{
System.out.println( "\nYou find yourself in a hallway with two doors. One is open and leads into a bathroom. The other is closed. Do you \"open\" the closed door, or go into the \"bathroom\"?" );
r3 = keyboard.next();
if ( r3.equals("open"))
{
System.out.println( "\nAhead of you you see only darkness. Do you \"step\" into the darkness, or do you close the door and \"leave\"?" );
r5 = keyboard.next();
if ( r5.equals("step"))
{
System.out.println( "\nYou step outside and into thin air, and then fall to your death.");
}
else if ( r5.equals("leave"))
{
System.out.println( "\nYou leave the house and safely go home. This time." );
}
}
else if ( r3.equals("bathroom"))
{
System.out.println( "\nYou walk into the bathroom and see that the shower curtain is closed. Do you \"open\" the shower curtain, or \"leave\" it closed?" );
r6 = keyboard.next();
if ( r6.equals("open"))
{
System.out.println( "\nYou see that someone has left the water running and turn it off, saving the homeowner hundreds of dollars. The homeowner comes home, and as a thank you for savign them this money, gives you $100." );
}
else if ( r6.equals("leave"))
{
System.out.println( "\nYou leave the house and safely go home. This time." );
}
}
}
else if ( r2.equals("basement"))
{
System.out.println( "\nAs you look around the basement, you see two things. The first is a TV, with a remote lying on the table next to it. The second is a closed door off to the side of the basement. Do you go to the \"TV\", or open the \"door\"?" );
r3 = keyboard.next();
if ( r3.equals("TV"))
{
System.out.println( "\nDo you want to turn the TV on? ( \"yes\" or \"no\")" );
r5 = keyboard.next();
if ( r5.equals("yes"))
{
System.out.println( "\nYou turn on the TV, watch Monday Night Football, and die of despair as you see Colin Kaepernick destroy any chances the 49ers have of having a winning season this year." );
}
else if ( r5.equals("no"))
{
System.out.println( "\nYou die of anxeity because you never got to know who won Dancing With the Stars, since you didn't turn on the TV." );
}
}
else if ( r3.equals("door"))
{
System.out.println( "\nAfter you open the door, you see only darkness, and hear a noise. Do you want to turn the light on in order to find out what the noise was? (\"yes\" or \"no\")" );
r6 = keyboard.next();
if ( r6.equals("yes"))
{
System.out.println( "\nYou turn on the light and discover a cat. You take the cat home, and it befriends you, and you have it for the next ten years." );
}
else if ( r6.equals("no"))
{
System.out.println( "\nYou leave and safely return home. This time" );
}
}
}
else if ( r2.equals("parlor"))
{
System.out.println( "\nAs you enter the parlor, the phone rings. Would you like to answer the phone? (\"yes\" or \"no\") " );
r3 = keyboard.next();
if ( r3.equals("yes"))
{
System.out.println( "\nYou hear only static over the phone. Do you say \"hello\" or \"hang up\"?" );
r5 = keyboard.next();
if ( r5.equals("hello"))
{
System.out.println( "\n\"Why are you in my house\", you hear over the phone. You immediately hang up and run sprinting from the house, and safely return home. This Time." );
}
else if ( r5.equals("hang up"))
{
System.out.println("\nYou are so panicked by the ringing of the phone that you go running out of the house, and eventually make it home safely. This Time." );
}
}
else if ( r3.equals("no"))
{
System.out.println( "\nThe voicemail answers and you hear a voice say \"Hello, we know you have broken into this house. We have you surrounded by two swat teams. Plese come out with your hands up. Do you \"listen\" and do what the cop asks you, or decide to try to \"escape\" from your current predicament?" );
r6 = keyboard.next();
if ( r6.equals("lsiten"))
{
System.out.println( "\nYou come out with your hands up, and the cops realize that you were simply exploring the house, and had no intention of burglary, so they let you go with a stern warning. You make it home safely. This Time." );
}
else if ( r6.equals("escape"))
{
System.out.println( "You go running from the house, and after about two seconds, you get tackeld by a policeman in full swat gear. You get arrested, and spend the next three years in prison. During your time in prison, you get a business degree, and once released, you get hired by, and after many years of hard work become CEO of, Google." );
}
}
}
}
}
Picture of the output