Assignment #77 and Adventure 2
Code
/// Name: Mahima Choudhary
/// Period: 6
/// Program Name: Adventure 2
/// File Name: Adventure2.java
/// Date Finished: 2/3/2016
import java.util.Scanner;
public class Adventure2
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
int nextroom = 1;
String choice = "";
while ( nextroom != 0 )
{
if ( nextroom == 1 )
{
System.out.println( "You are in the mall. There is a \"up\" and a \"down\" escalator." );
System.out.print( "> " );
choice = keyboard.nextLine();
if ( choice.equals("up") )
nextroom = 2;
else if ( choice.equals("down") )
nextroom = 3;
else
System.out.println( choice + " wasn't one of the options. Try again." );
}
if ( nextroom == 2 )
{
System.out.println( "You accidentally walked into a baby store \"back\"." );
System.out.print( "> " );
choice = keyboard.nextLine();
if ( choice.equals("back") )
nextroom = 1;
else
System.out.println( choice + " wasn't one of the options. Try again." );
}
if ( nextroom == 3 )
{
System.out.println( "Hooray this place has super cute dresses do you want to try on the \"red\" mermaid dress or the \"blue\" cocktail one." );
choice = keyboard.nextLine();
System.out.print( "> " );
if ( choice.equals("red") )
nextroom = 1;
else if ( choice.equals("blue") )
nextroom = 4;
else
System.out.println( choice + " wasn't one of the options. Try again." );
}
if ( nextroom == 4 )
{
System.out.println( "Its a little tight but the dont have any other sizes will you \"buy\" or try on \"more\"." );
choice = keyboard.nextLine();
System.out.print( "> " );
if ( choice.equals("buy") )
nextroom = 5;
else if ( choice.equals("more") )
nextroom = 6;
else
System.out.println( choice + " wasn't one of the options. Try again." );
}
if ( nextroom == 5 )
{
System.out.println( "Great what a great choice, remember you can alwasy get it altered too" );
nextroom = 0;
}
if ( nextroom == 6 )
{
System.out.println( "UGH, you cant find any other dresses that are cute and are in your size, oh well, you will end up going to prom in soccer clothes" );
nextroom = 0;
}
}
System.out.println( "\nWell anyways thanks for playing!" );
}
}
Picture of the output