Assignemnt #45: Choose your own Adventure
Code
/// Name: Sean Harrison
/// Period: 7
/// Program name: Choose your own Adventure
/// File Name: ChooseYourOwnAdventure.java
/// Date Finished: 10/22/2015
import java.util.Scanner;
public class ChooseYourOwnAdventure
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
String direction, decisionLever, decisionBandit, decisionWater, decisionRope, decisionOnward;
System.out.println( "Welcome traveler to an adventure " );
System.out.println( "You awake in a pool of water deep beneath a cave nearby is a deep pool of water. Would you like to dive into the \"Pool\" or explore the \"Cavern\" " );
direction = keyboard.nextLine();
if (direction.equals("Cavern") )
{
System.out.println( "You stumble into a dimly lit room and find a passageway and a basement door would you like to go through the passage or door? (\"Door\" or \"Passage\") " );
if ( direction.equals("Door") )
{
System.out.println( "You proceed to go down the basment, you see a nearby lever do you pull it? (\"Yes\" or \"No\" ) " );
decisionLever = keyboard.nextLine();
if ( decisionLever.equals("Yes") )
{
System.out.println( "You pull the strange lever and the floor opens up and you fall down a deep pitt to your doom" );
}
else if ( decisionLever.equals("No") )
{
System.out.println( "Ignoring the lever, you soon walk forward onto a pressure triggered plate and your're impaled, your adventure is over" );
}
}
else if ( direction.equals("Passage") );
{
System.out.println(" You walk into a long cooridor and see a scantily clothed bandit sleeping, do you wake him up or slit his throat? (\"Wake up\" or \"Slit throat\") " );
decisionBandit = keyboard.nextLine();
if ( decisionBandit.equals("Wake up") )
{
System.out.println( "You attempt to wake up the bandit and he quickly grabs his sword thrusting it through your heart killing you. Your adventure is over" );
}
else if ( decisionBandit.equals("Slit throat") )
{
System.out.println(" You quickly slit the bandits throat spraying blood everywhere. Next to his bed you find a map showing an escape route nearby. Congrats on escaping! " );
}
}
}
else if (direction.equals("Pool") )
{
System.out.println( "You dive deep into a pool and notice there is a light through a small gap, would you like to attempt to swim through or swim in the direction you were initally headed? (\"New direction\" or \"Same direction\") " );
decisionWater = keyboard.nextLine();
if (decisionWater.equals("New direction") )
{
System.out.println( "Somehow, you managed to emerge in a small chamber with some oxygen, and a dangling rope. Do you climb the rope towards a ledge? (\"Yes\" or \"No\") " );
decisionRope = keyboard.nextLine();
if (decisionRope.equals("Yes") )
{
System.out.println( " You attempt to climb the rope and suceed, but when you climb onto the ledge you loose your grip and fall breaking your neck. Your adventure is over " );
}
else if (decisionRope.equals("No") )
{
System.out.println( "You do not climb the rope, and soon die when you've exhausted the chambers supply of oxygen" );
}
}
else if ( decisionWater.equals("Same direction") )
{
System.out.println( "You continue swimming ahead toward the light but you realize your almost out of breath, do you continue onward? (\"Yes\" or \"No\") " );
decisionOnward = keyboard.nextLine();
if (decisionOnward.equals("Yes") )
{
System.out.println( "Somehow, you manage to emerge from the water into a cool mountain lake outside of the cave. You're alive and well and lucky to be alive, congrats on escaping! " );
}
else if (decisionOnward.equals("No") )
{
System.out.println( "Panicked, you try to swim back but in the darkness you loose your sense of direction and soon after drown. Your adventure is over " );
}
}
}
}
}
Picture of the output