Assignemnt #44, Twenty Questions... well, actually just Two
Code
/// Name: Alex Pinder
/// Period: 5
/// Program Name: Twenty Questions... well, actually just Two
/// File Name: prog44.java
/// Date Complete:
import java.util.Scanner;
public class prog44
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
String qOne, qTwo;
System.out.println( "TWO QUESTIONS!\nThink of an object, and I'll try to guess it.\n \nQuestion 1. Is it an animal vegetable, or mineral? " );
qOne = keyboard.next();
System.out.println( "\nQuestion 2. Is it bigger than a breadbox? " );
qTwo = keyboard.next();
if ( qOne.equals("animal") )
{
if ( qTwo.equals("yes") )
{
System.out.println( "My guess is that you are thinking of a moose." );
}
else if ( qTwo.equals("no") )
{
System.out.println( "My guess is that you are thinking of a squirrel." );
}
}
else if ( qOne.equals("vegetable") )
{
if ( qTwo.equals("yes") )
{
System.out.println( "My guess is that you are thinking of a watermelon." );
}
else if ( qTwo.equals("no") )
{
System.out.println( "My guess is that you are thinking of a carrot." );
}
}
else if ( qOne.equals("mineral") )
{
if ( qTwo.equals("yes") )
{
System.out.println( "My guess is that you are thinking of a Camaro." );
}
else if ( qTwo.equals("no") )
{
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 really care." );
}
}
Picture of the output