Assignemnt #45 and Choose Your Own Adventure
Code
/// Name: Tristan Chung
/// Period: 5
/// Program Name: Tristan's Adventure
/// File Name: TAdven.java
/// Date Finished: 11/4/2015
import java.util.Scanner;
public class TAdven
{
public static void main(String [] args )
{
String r1, r2, r3, r4, r5, r6, r7;
Scanner keyboard = new Scanner(System.in);
System.out.println("You are in San Fransisco! Would you like to go Union Square or Fisherman's Wharf?");
System.out.print("> ");
r1 = keyboard.next();
if ( r1.equals("Union_Square"))
{
System.out.println(" At Union Square, somebody dropped a 100 dollar bill on the ground. Do you pick it up? (yes or no)");
System.out.print("> ");
r2 = keyboard.next();
if ( r2.equals("yes"))
{
System.out.println("You now have a choice. Would you rather buy a shoe or give to charity? (shoe or charity)");
System.out.print("> ");
r4 = keyboard.next();
if (r4.equals("shoe"))
{
System.out.println(" You get mugged of all your belongings including the clothing on your back. Youare forced to walk home unclothed without money for a taxi.");
}
else if(r4.equals("charity"))
{
System.out.println("Because of your kind heart, your bank account recieved anonymous donation of 1 million dollars.");
}
}
else if (r2.equals("no"))
{
System.out.println("You then walk to union square. You see a pretty girl. Do you go talk to her? (yes or no)");
System.out.print("> ");
r5 = keyboard.next();
if (r5.equals("yes"))
{
System.out.println("You go talk to her and she happens to live in your area. Now you have a date for next weekend.");
}
else if (r5.equals("no"))
{
System.out.println("You have lost your chance with finding love and you live alone forever. Ouch");
}
}
}
else if ( r1.equals("Fisherman's_Wharf"))
{
System.out.println(" At Fisherman's Wharf, there is a circus and a exploritorium. Would you rather go to the circus or the exploratorium?");
System.out.print("> ");
r3 = keyboard.next();
if (r3.equals("exploratorium"))
{
System.out.println(" At the exploratiorium, you are fascinated by the exhibits. But you notice that one machine is not working right. Do you tell somebody about it?(yes or no)");
System.out.print("> ");
r6 = keyboard.next();
if (r6.equals("yes"))
{
System.out.println("Good choice! You saved somebody's life and you are hired by the exploratorium!");
}
else if (r6.equals("no"))
{
System.out.println("After you leave that exhibit, a child goes up to it and the machine explodes. The child is injured and you are left with guilt.");
}
}
else if ( r3.equals("circus"))
{
System.out.println("At the circus, you sit down to watch the show. The circus performers ask for a volunteer from the audience. Do you volunteer?(yes or no)");
System.out.print("> ");
r7 = keyboard.next();
if (r7.equals("yes"))
{
System.out.println("You volunteer and asked to stand below a ring of fire. A lion attempts to jump through it but slips and eats your head. RIP");
}
else if (r7.equals("no"))
{
System.out.println("You dont raise your hand and instead you watch the fantastic show in the stands. You go home and live the rest of your very normal life. The end.");
}
}
}
}
}
Picture of the output