Assignment #44 and Twenty Questions... well, actually just Two
Code
/// Name: Lauren Baird
/// Period: 7
/// Program Name: Twenty Questions... well, actually just Two
/// File Name: TwentyQuestions.java
/// Date Finished: 10/15/2015
import java.util.Scanner;
public class TwentyQuestions
{
public static void main( String[] args )
{
String first, second;
Scanner keyboard = new Scanner(System.in);
System.out.println();
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?" );
first = keyboard.next();
System.out.println();
System.out.println( "Question 2) Is it bigger than a breadbox?" );
second = keyboard.next();
if ( first.equals( "animal" ) && second.equals( "yes" ) )
{
System.out.println();
System.out.println( "My guess is that you are thinking of a moose." );
}
else if ( first.equals( "animal" ) && second.equals( "no" ) )
{
System.out.println();
System.out.println( "My guess is that you are thinking of a squirrel." );
}
else if ( first.equals( "vegetable" ) && second.equals( "yes" ) )
{
System.out.println();
System.out.println( "My guess is that you are thinking of a watermelon." );
}
else if ( first.equals( "vegetable" ) && second.equals( "no" ) )
{
System.out.println();
System.out.println( "My guess is that you are thinking of a carrot." );
}
else if ( first.equals( "mineral" ) && second.equals( "yes" ) )
{
System.out.println();
System.out.println( "My guess is that you are thinking of a Camaro." );
}
else if ( first.equals( "mineral" ) && second.equals( "no" ) )
{
System.out.println();
System.out.println( "My guess is that you are thinking of a paper clip." );
}
System.out.println( "I would ask you if I'm right, but I don't actually care." );
System.out.println();
}
}