Programming Assignment #47

Code

/// Name: Dylan Sleeper
/// Period: 6
/// Program Name: Else and If
/// File Name: questions.java
/// Date Finished: 10/22/2015

import java.util.Scanner;

public class questions{

    public static void main(String[] args){
        
        Scanner keyboard = new Scanner(System.in);
        
        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? ");
        
        String answer1 = keyboard.next();
        System.out.println();
        System.out.print("Question 2) Is it a living thing? ");
        
        String answer2 = keyboard.next();
        System.out.println();
        
        if(answer1.equalsIgnoreCase("outside") && answer2.equalsIgnoreCase("yes")){
            System.out.println("You must be thinking of a bison!");
        }
        if(answer1.equalsIgnoreCase("outside") && answer2.equalsIgnoreCase("no")){
            System.out.println("You must be thinking of a billboard!");
        }
        if(answer1.equalsIgnoreCase("inside") && answer2.equalsIgnoreCase("yes")){
            System.out.println("You must be thinking of a house plant!");
        }
        if(answer1.equalsIgnoreCase("inside") && answer2.equalsIgnoreCase("no")){
            System.out.println("You must be thinking of a shower curtain!");
        }
        if(answer1.equalsIgnoreCase("both") && answer2.equalsIgnoreCase("yes")){
            System.out.println("You must be thinking of a dog!");
        }
        if(answer1.equalsIgnoreCase("both") && answer2.equalsIgnoreCase("no")){
            System.out.println("You must be thinking of a cell phone!");
        }
    }
    
}
  

Outputs

Assignment 15