Assignment #47

Code

///Name: Mahima Choudhary
///Period: 6
///Project Name: TwoMoreQuestions
///File Name: TwoMoreQuestions.java
///Date Finished: 11/17/15

    import java.util.Scanner;

    public class TwoMoreQuestions
    {
        public static void main(String[] args)
        {
            Scanner keyboard = new Scanner(System.in);
            
            String answer1, answer2;
            
            System.out.println("TWO MORE QUESTIONS!");
            System.out.println();
            System.out.println("Think of something and I'll try to guess it!");
            System.out.println();
            
            System.out.print("Question 1) Does it stay inside or outside or both? ");
            answer1 = keyboard.next();
            
            System.out.print("Question 2) Is it a living thing? ");
            answer2 = keyboard.next();
            
            System.out.println();
            
            if ( answer1.equals("inside") && answer2.equals("yes") )
                System.out.println("It must be a cat!");
            
            if ( answer1.equals("outside") && answer2.equals("yes") )
                System.out.println("It must be a dolphin!");
                
            if ( answer1.equals("both") && answer2.equals("yes") )
                System.out.println("It must be a giraffe!");
                
            if ( answer1.equals("inside") && answer2.equals("no") )
                System.out.println("It must be a book!");
                
            if ( answer1.equals("outside") && answer2.equals("no") )
                System.out.println("It must be a toilet!");
            
            if ( answer1.equals("both") && answer2.equals("no") )
                System.out.println("It must be a lava lamp!");
        }
    }

Picture of the output

YourInitials.html