Prog 44: Twenty Questions... Well, actually just Two
///Name: Ilana Levy
///Period: 5
///Program Name: Twenty Questions... well, actually just Two
///File Name: twentyTwo.java
///Date Finished: 9/10/2015
import java.util.Scanner;
public class twentyTwo
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner( System.in);
String size, type, animal, vegetable, mineral, yes, no;
System.out.println( "TWO QUESTIONS! \n Think of an object, and Ill try to guess it." );
System.out.println( " Question 1) Is it an animal, vegetable, or mineral?" );
type = keyboard.next();
System.out.println( " Question 2) Is it bigger than a breadbox?" );
size = keyboard.next();
if ( type.equals("animal" ) && size.equals( "no" ))
{
System.out.println( "My guess is that you are thinking of a mouse. \n I would ask you if I'm right, but I don't actually care. " );
}
if ( type.equals("vegetable") && size.equals("no"))
{
System.out.println( "My guess is that you are thinking of a beet. \n I would ask you if I'm right, but I don't actually care. " );
}
if ( type.equals("mineral") && size.equals("no"))
{
System.out.println( "My guess is that you are thinking of a oz of gold. \n I would ask you if I'm right, but I don't actually care. " );
}
if ( type.equals("animal") && size.equals("yes"))
{
System.out.println( "My guess is that you are thinking of a bear. \n I would ask you if I'm right, but I don't actually care. " );
}
if ( type.equals("vegetable") && size.equals("yes"))
{
System.out.println( "My guess is that you are thinking of a pumpkin. \n I would ask you if I'm right, but I don't actually care. " );
}
if ( type.equals("mineral") && size.equals("yes"))
{
System.out.println( "My guess is that you are thinking of a cliff face. \n I would ask you if I'm right, but I don't actually care. " );
}
}
}