Assignemnt #45 and Adventure
Code
/// Name: Raff Lisbona
/// Period: 6
/// Program Name: Adventure
/// File Name: Adventure.java
/// Date Finished: 10/26/2015
import java.util.Scanner;
public class Adventure
{
public static void main( String[] args )
{
String a1, a2, a3, a4, a5, a6, a7;
String fight, join, stay, run, sword, mushroom, yes, no, Earth, home, heads, tails;
Scanner keyboard = new Scanner(System.in);
System.out.println("Welcome to Raff's Madagascar Rainforest Rumble!");
System.out.println(" ");
System.out.println("You are exploring a rainforest in Madagascar and you happen to lose the rest of your crew. You are left all alone. A herd of lemurs approaches you. You can either \"fight\" them or \"join\" them.");
System.out.print("> ");
a1 = keyboard.next();
System.out.println(" ");
if ( a1.equals("fight"))
{
System.out.println("You have killed a few of the lemurs but more are coming. You see a cave off in the distance but it will be a far run. You can \"stay\" and continue to fight them or you can \"run\" to the cave.");
System.out.print("> ");
a2 = keyboard.next();
System.out.println(" ");
if ( a2.equals("stay"))
{
System.out.println("More lemurs have come. You know you can't fight all of them on your own. You see a \"sword\" and a \"mushroom\" on the ground. What do you pick up?");
System.out.print("> ");
a3 = keyboard.next();
System.out.println(" ");
if ( a3.equals("sword"))
{
System.out.println("You pick up the sword but you realize it's made out of foam. In the time it takes you to pick it up the lemurs are already all over you and are eating you alive. YOU ARE DEAD.");
}
else if ( a3.equals("mushroom"))
{
System.out.println("You pick up the mushroom and quickly pop it into your mouth. You then realize it was a hallucinogenic mushroom. The lemurs have now all turned into cute puppies and when you go to pet them they eat you very violently. YOU ARE DEAD.");
}
}
else if ( a2.equals("run"))
{
System.out.println("You get to the cave and notice that the lemurs don't come in (kind of weird). You then realize that this is because a komodo dragon lives in the cave. You see a crack \"pipe\" and a \"toothbrush\" on the ground. What do you pick up?");
System.out.print("> ");
a4 = keyboard.next();
System.out.println(" ");
if ( a4.equals("pipe"))
{
System.out.println("The komodo dragon is actually addicted to crack too so when he realizes that you might be able to help him pay for his addiction, he befriends you. You and the komodo dragon live in the cave together for several years, smoking crack together. One day he suspects you of stealing his crack so he decides to eat you. YOU ARE DEAD.");
}
else if ( a4.equals("toothbrush"))
{
System.out.println("The komodo dragon is angry with you for picking up his toothbrush so he kills you. YOU ARE DEAD.");
}
}
}
else if ( a1.equals("join"))
{
System.out.println("The lemurs get together to decide whether or not to let you join them. They want to ask you some interview questions. Are you from this planet? (yes or no)");
System.out.print("> ");
a5 = keyboard.next();
System.out.println(" ");
if ( a5.equals("no"))
{
System.out.println("The lemurs want you to take them to your leader. Is your leader on \"Earth\" or is he still at your \"home\" planet?");
System.out.print("> ");
a6 = keyboard.next();
System.out.println(" ");
if ( a6.equals("home"))
{
System.out.println("The lemurs are offended that your leader didn't come with you to the wonderful planet, Earth, so they decide to throw you in a pit of crocodiles. YOU ARE DEAD.");
}
else if ( a6.equals("Earth"))
{
System.out.println("The lemurs force you to take them to your leader and they get ahold of your species advanced technology and they wipe out your entire race. YOU ARE DEAD.");
}
}
else if ( a5.equals("yes"))
{
System.out.println("The lemurs want you to decide your fate at random. They flip a coin. Do you choose \"heads\" or \"tails.\"");
System.out.print("> ");
a7 = keyboard.next();
System.out.println(" ");
if ( a7.equals("heads"))
{
System.out.println("Heads means that you will be thrown into a hot firey inferno. YOU ARE DEAD.");
}
else if ( a7.equals("tails"))
{
System.out.println("You have been voted in as the leader of all lemurs on Madagascar. You have won this game. TAILS NEVER FAILS.");
}
}
}
}
}
Picture of the output