Assignemnt #44 and TwoQuestions
Code
/// name: Leila Ordukhani
/// period: 6
/// program name: Thirty-Third Program
/// file name: TwoQuestions.java
/// date finished: 10/21/15
import java.util.Scanner;
public class TwoQuestions
{
public static void main(String[] args)
{
String answer1, answer2;
Scanner keyboard = new Scanner(System.in);
System.out.println("Two Questions!");
System.out.println("Think of an object, I'll try to guess it.");
System.out.println();
System.out.println("Question 1) Is it an animal, vegetable, or mineral?");
answer1 = keyboard.next();
System.out.println();
System.out.println("Question 2) Is it bigger than a breadbox?");
answer2 = keyboard.next();
System.out.println();
if ( answer1.equals("animal") && answer2.equals("yes") )
{
System.out.println("My guess is that you are thinking of a lion.");
}
else if ( answer1.equals("animal") && answer2.equals("no") )
{
System.out.println("My guess is that you are thinking of an ant.");
}
else if ( answer1.equals("vegetable") && answer2.equals("yes") )
{
System.out.println("My guess is that you are thinking of a pineapple.");
}
else if ( answer1.equals("vegetable") && answer2.equals("no") )
{
System.out.println("My guess is that you are thinking of a potato.");
}
else if ( answer1.equals("mineral") && answer2.equals("yes") )
{
System.out.println("My guess is that you are thinking of a car.");
}
else if ( answer1.equals("mineral") && answer2.equals("no") )
{
System.out.println("My guess is that you are thinking of an eraser.");
}
System.out.println("I would ask you if I'm right, but I don't actually care.");
}
}
Picture of the output