Assignemnt #77

Code


 /// Name: Daniel Nguyen
 /// Period: 6
 /// Program Name: ad2 Program
 /// File Name: ad2.java
 /// Date Finished: 9/9/2015

// 1 living room
// 2 upstairs
// 3 kitchen
// 4 laundry room
// 5 super portal
// 6 oven

import java.util.Scanner;

public class ad2
{
	public static void main( String[] args )
	{
		Scanner keyboard = new Scanner(System.in);
        int room = 1;
        int choice = 0;
        int hp = 1;
        while (hp != 0) {
            if (room == 1){
                System.out.println("You are in the living room of someone's house...");
                System.out.println("Do you go 1.upstairs or in the 2.kitchen?'");
                System.out.print("> ");
                choice = keyboard.nextInt();
                if (choice == 1) {
                    room = 2;
                }
                else if (choice == 2) {
                    room = 3;
                }
            }
            if (room == 2) {
                System.out.println("Do you go in the 1.laundry room or the 2.superportal");
                System.out.print("> ");
                choice = keyboard.nextInt();
                if (choice == 1) {
                    room = 4;
                }
                else if (choice == 2) {
                    room = 5;
                }
            }
            if (room == 3) {
                System.out.println("Do you go in the 1.oven or 2.living room?");
                System.out.print("> ");
                choice = keyboard.nextInt();
                if (choice == 1) {
                    room = 6;
                }
                else if (choice == 2) {
                    room = 1;
                }
            }
            if (room == 4) {
                System.out.println("Do you go 1.upstairs or in the 2.kitchen");
                System.out.print("> ");
                choice = keyboard.nextInt();
                if (choice == 1) {
                    room = 2;
                }
                else if (choice == 2) {
                    room = 3;
                }
            }
            if (room == 5) {
                System.out.println("Your body gets compressed and all your bones get crushed and youu...... died...");
                hp = 0;
                }
            if (room == 6) {
                System.out.println("The oven door locks and the heat turns on.. You slowly become someone's dinner!");
                hp = 0;
                }
            }
        }
	}















    


    

Picture of the output

Assignment 3
BACK HOME NEXT