Assignment 44
import java.util.Scanner;
public class QuestionsGame
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
String answer1, answer2;
System.out.print("TWO QUESTIONS!\nThink of an object, and I'll try to guess it.\n\nQuestion 1) Is it animal, vegetable, or mineral?\n>");
answer1 = keyboard.next();
if (answer1.equals("animal"))
{
System.out.print("\nQuestion 2) Is it bigger than a breadbox?\n>");
answer2 = keyboard.next();
if (answer2.equals("yes"))
{
System.out.println("\nMy guess is that you are thinking of a moose.");
}
else
{
System.out.println("\nMy guess is that you are thinking of a squirrel.");
}
}
else if (answer1.equals("vegetable"))
{
System.out.print("\nQuestion 2) Is it bigger than a breadbox?\n>");
answer2 = keyboard.next();
if (answer2.equals("yes"))
{
System.out.println("\nMy guess is that you are thinking of a watermelon.");
}
else
{
System.out.println("\nMy guess is that you are thinking of a carrot.");
}
}
else
{
System.out.print("\nQuestion 2) Is it bigger than a breadbox?\n>");
answer2 = keyboard.next();
if (answer2.equals("yes"))
{
System.out.println("\nMy guess is that you are thinking of a car.");
}
else
{
System.out.println("\nMy 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.");
}
}