Assignemnt #44

Code

/// Name: Ryan Volko
/// Period: 7
/// Program Name: Question
/// File Name: Question.java
/// Date Finished: 11/12/2015
import java.util.Scanner;
class Question{

    public static void main(String[] args) {
    
    Scanner keyboard = new Scanner(System.in);
    
   String Q1, Q2, answer; 
            
            answer="";
        
            System.out.println("Two Questions!");
            System.out.println("Think of an object, and i'll try to guess it!");
            System.out.println("");
            System.out.println("Question 1.) Is it an animal, fruit, or golf equipment?");        
            System.out.print(">");
            Q1 = keyboard.next();
            System.out.println("");
            System.out.println("Question 2.) Is it bigger than a breadbox?");
            System.out.print(">");
            Q2 = keyboard.next();
            System.out.println("");
            
            if (Q1.equals("animal"))
            {
                if (Q2.equals("no"))
                {
                    answer = "rat";
                }
                else if (Q2.equals("yes"))
                {
                    answer = "blue whale";
                }
            }
            
            else if (Q1.equals("fruit"))
            {
                if (Q2.equals("no"))
                {
                    answer = "cherry";
                }
                else if (Q2.equals("yes"))
                {
                    answer = "watermelon";
                }
            }
            
            else if (Q1.equals("golf equipment"))
            {
                if (Q2.equals("no"))
                {
                    answer = "golf ball";
                }
                else if (Q2.equals("yes"))
                {
                    answer = "golf bag";
                }
            }
            
            else
            {
                System.out.println("You didn't choose one of the given choices");
                answer = "Error";
            }
            
            System.out.println("My guess is that you are thinking of a " + answer + ".");
            System.out.println( " " );
            System.out.println( "If I was right that means i win..... but if got it wrong i really dont care to much");
        }
    }

    

Picture of the output

Assignment 44