Code
/// Name: Afaf Nabeeha
/// Period: 7
/// Program Name: Twenty Questions... Na just Two
/// File Name: Questions.java
/// Date Finished: 11/12/2015 public class Questions
import java.util.Scanner;
public class Questions
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
String A1, A2, Yes, No, A, B, C;
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, vegetable, or mineral? " );
System.out.print( "> " );
A1 = keyboard.next();
System.out.println();
System.out.println( "Question 2) Is it bigger than a breadbox? " );
System.out.print( "> " );
A2 = keyboard.next();
System.out.println();
if ( A1.equals("animal") )
{
A = "squirrel";
B = "moose";
}
else if ( A1.equals("vegetable") )
{
A = "carrot";
B = "watermelon";
}
else if ( A1.equals("mineral") )
{
A = "paper clip";
B = "Camaro";
}
else
{
A = "error";
B = "error";
}
if ( A2.equals("yes") )
{
C = B;
}
else if ( A2.equals("no") )
{
C = A;
}
else
{
C = "error";
}
System.out.println( "My guess is that you are thinking of A " + C + "." );
System.out.println( "I would ask you if I'm right, but I don't actually care. " );
}
}
Picture of the output