Project 1
code
///Name: Mutsu Osoegawa
///Period: 7
///Project Name: Choose Your Own Slightly Longer Adventure!
///File Name: SlightlyLongerAdventure.java
///Date: 11/13/2015
import java.util.Scanner;
public class SlightlyLongerAdventure
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
String option1, option2, option3;
option1 = "a";
option2 = "b";
option3 = "c";
System.out.println( "WELCOME TO MUTSU'S TINY ADVENTURE 2!!" );
System.out.println( "You are in a ghost town! Would you like to go \"left\", \"right\", or \"straight\"? " );
System.out.print( "> " );
option1 = keyboard.next();
System.out.println();
if ( option1.equals("left") )
{
System.out.println( "You see two buildings. Would you like to go into the \"bank\" or the \"grocery store\" " );
System.out.print( "> " );
option2 = keyboard.next();
if ( option2.equals("bank") )
{
System.out.println( "Would you like to \"search the safe\" or \"enter the office\"?" );
System.out.print( "> " );
option3 = keyboard.nextLine();
if ( option3.equals("search the safe") )
{
System.out.println( "You find nothing interesting...better keep moving. " );
}
else if ( option3.equals("enter the office") )
{
System.out.println( "A band of bandits are present. You unleash your firearm to disband disband them. " );
}
}
else if ( option2.equals("grocery store") )
{
System.out.println( "The store is mostly ransacked. Would you like to take an \"apple\" or \"bannana\"? " );
System.out.print( "> " );
option3 = keyboard.next();
if ( option3.equals("apple") )
{
System.out.println( "You eat the apple and decide to move one. " );
}
else if ( option3.equals("bannana") )
{
System.out.println( "You eat a bannana. Seems to be rotten...ew. " );
}
}
}
else if ( option1.equals("right") )
{
System.out.println( "You see a river running along the left and the hills towards the right." );
System.out.println( "Would you like to go \"left\" or \"right\" " );
System.out.print( "> " );
option2 = keyboard.next();
if ( option2.equals("left" ) )
{
System.out.println( "You arrive at the river and you see a raft. Would you like to \"fish\" for food or continue your journey with the \"raft\"? " );
System.out.print( "> ");
option3 = keyboard.next();
if( option3.equals("fish") )
{
System.out.println( "You catch some fish for food. " );
}
else if (option3.equals("raft") )
{
System.out.println( "Your journey continues into the unknown. " );
}
}
else if (option2.equals("right") )
{
System.out.println( "You arrive at the hills. " );
System.out.println( "Would you like to \"hunt\" for game or make \"shelter\"? " );
option3 = keyboard.next();
if (option3.equals("hunt"))
{
System.out.println( "You kill a deer with your gun. " );
}
else if (option3.equals("shelter") )
{
System.out.println( "You make shelter and prepare for the next day. " );
}
}
}
else if ( option1.equals("straight") )
{
System.out.println( "You arrive at a giant house. Would you like to \"enter\" or \"move on\"? " );
System.out.print( "> " );
option2 = keyboard.next();
if (option2.equals("move on") )
{
System.out.println( "You arrive at a forest. Would you like to \"go back\" or \"move on\"? " );
System.out.print( "> " );
option3 = keyboard.next();
if (option3.equals("go back") )
{
System.out.println( "You find a gang of hunters behind you. You decide to join them in the hunt for the beast in the forest. " );
}
else if (option3.equals("move on") )
{
System.out.println( "You go inside the forest alone. You begin a new chapter in your journey... " );
}
}
else if (option2.equals("enter") )
{
System.out.println( "Seems to be a creepy house. Would you like to enter the \"kitchen\" or \"upstairs\"? " );
System.out.print( "> " );
option3 = keyboard.next();
if (option3.equals("kitchen") )
{
System.out.println( "You find a crazy woman with a kitchen knife... better escape. " );
}
else if (option3.equals("upstairs") )
{
System.out.println( "You find some equipment to take with you in your journey. " );
}
}
}
}
}