Assignemnt #44 Twenty Questions... well, actually just Two
Code
/// Name: Jake Johnson
/// Period: 7
/// Program Name: TwoQuestions
/// File Name: TwoQuestions.java
/// Date Finished: 11/5/2015
import java.util.Scanner;
public class TwoQuestions
{
public static void main (String[] args)
{
Scanner keyboard = new Scanner(System.in);
String Q1Answer, Q2Answer;
System.out.println("Question 1) Is it an animal, vegetable, or mineral?");
Q1Answer = keyboard.next();
System.out.println();
System.out.println("Question 2) Is it bigger than a breadbox?");
Q2Answer = keyboard.next();
if (Q1Answer.equals("animal") && Q2Answer.equals ("no"))
{
System.out.println("You're thinking of a squirrel!");
}
else if (Q1Answer.equals ("animal") && Q2Answer.equals ("yes"))
{
System.out.println("You're thinking of a moose!");
}
else if (Q1Answer.equals ("vegetable") && Q2Answer.equals ("no"))
{
System.out.println("You're thinking of a carrot!");
}
else if (Q1Answer.equals ("vegetable") && Q2Answer.equals ("yes"))
{
System.out.println("You're thinking of a watermelon!");
}
else if (Q1Answer.equals ("mineral") && Q2Answer.equals ("no"))
{
System.out.println("You're thinking of a paper clip!");
}
else if (Q1Answer.equals ("mineral") && Q2Answer.equals ("yes"))
{
System.out.println("You're thinking of a Camaro!");
}
}
}!
Picture of the output