Assignment # 47 and Two More Questions

Code

    /// Name: Tommy Oyuntseren
    /// Period: 7
    /// Program Name: TwoMoreQuestions
    /// File Name: TwoMoreQuestions.java
    /// Date: 11/16/2015

import javax.swing.*;

public class TwoMoreQuestions
{
    public static void main(String[] args)
    {
        byte type;
        byte size = 0;

        String[][] guess = { {"houseplant","bison","dog"},{"shower curtain","billboard","cell phone"}};

        String name = JOptionPane.showInputDialog("Question 1) Does it stay inside, outside or both?");

        switch (name)
        {
            case "inside": type = 0;
                break;
            case "outside": type = 1;
                break;
            case "both": type = 2;
                break;
            default: type = 99;
        }

        {
            name = JOptionPane.showInputDialog("Question 2) Is it alive? Y/N");

            switch (name)
            {
                case "Y": size = 0;
                    break;
                case "N": size = 1;
                    break;
                default: size = 99;
            }

            if (size!=99)
            {
                System.out.println();
                System.out.println("My guess is that you are thinking of a "+guess[size][type]+"!!!");
                System.out.println("I am sure that I am right and so I won't ask you for confirmation.");
                System.out.println();
            }

        }
    }
}


    
   
  

Picture of the output

Assignment 47