Assignment #77 Short Adventure 2: With a Loop

Code

      ///Name: Ian Grant
      ///Period:5
      ///Project Name: Short Adventure 2: With a Loop
      ///File Name:Adv2.java
      ///12/10/15
      
      import java.util.Scanner;
      public class Adv2
      {
      	public static void main(String[] args)
      	{
      		Scanner stuff = new Scanner(System.in);
      		int nextroom = 1;
      		String choice = "";
      		while (nextroom != 0)
      		{
      			if (nextroom == 1)
      			{
      				System.out.println("You are wandering the forest and you stumble apon a kitchen and hear in the background someone yelling.");
                      System.out.println("Do you want to go to the \"kitchen\" or check out the \"yelling\"?");
      				System.out.print("> ");
      				choice = stuff.nextLine();
      				if (choice.equals("kitchen"))
      					nextroom = 2;
      				else if (choice.equals("yelling"))
      					nextroom = 3;
      				else
      					System.out.println("ERROR.");
      			}
      			if (nextroom == 2)
      			{
      				System.out.println("You walk up to the kitchen and start to cook.");
                      System.out.println("There are a recipe on the table, would you like to make the \"Sandwich of Justice\" or go \"back\"?");
      				System.out.print("> ");
      				choice = stuff.nextLine();
      				if (choice.equals("Sandwich of Justice"))
      					nextroom = 4;
                      else if (choice.equals("back"))
      					nextroom = 1;
      				else
      					System.out.println("ERROR.");
      			}
                  if (nextroom == 3)
      			{
      				System.out.println("You walk in the direction of the yelling and find someone selling hoods.");
                      System.out.println("Would you like to \"buy\" a hood or go \"back\"?");
      				System.out.print("> ");
      				choice = stuff.nextLine();
      				if (choice.equals("back"))
      					nextroom = 1;
                      else if (choice.equals("buy"))
                               nextroom=5;
      				else
      					System.out.println("ERROR.");
      			}
                  if (nextroom == 4)
      			{
      				System.out.println("You start making the Sandwich of Justice and you burn the bread, while cooking the eggs because you suck at cooking.");
                      System.out.println("Do you eat the \"sandwhich\" or go \"back\".");
      				System.out.print("> ");
      				choice = stuff.nextLine();
      				if (choice.equals("sandwhich"))
                      {
                          System.out.println("The Sandwich of Justice kills you because you cooked the bread for longer than five minutes.");
      					nextroom = 0;
                      }
                      else if (choice.equals("back"))
                               nextroom=1;
      				else
      					System.out.println("ERROR.");
                  }
                  if (nextroom==5)
                  {
                      System.out.println("The price of the hood is one msk because of his wife is ill.");
                      System.out.println("You offer to buy the hood but he says \"hood no for sale\" and runs away.");
                      System.out.println("Would you like to \"chase\" after him or go \"back\"?");
                      choice = stuff.nextLine();
                      if (choice.equals("hood no for sale"))
                      {
                          System.out.println("SECRET ENDING!!!");
                          System.out.println("Hood for sale. You buy hood for one msk.");
      					nextroom = 0;
                      }
                      else if (choice.equals("chase"))
                      {
                          System.out.println("You chase after and trip on a hood on the ground and die.");
                          nextroom = 0;
                      }
                      else if (choice.equals("back"))
                               nextroom=1;
                  }
      
      		}
      		System.out.println("\nFin.");
      	}
      }
      

Output