Assignemnt #44
Code
///colin hinton
///5th period
///two questions
///TwoQuestions.java
//10/13/2015
import java.util.Scanner;
class TwoQuestions
{
public static void main (String [] args)
{
Scanner keyboard = new Scanner(System.in);
String questOne, questTwo;
System.out.print("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?");
questOne = keyboard.next();
if (questOne.equals ("animal"))
{
System.out.println("Question 2) Is it bigger than a breadbox?");
questTwo = keyboard.next();
if (questTwo.equals ("yes"))
{
System.out.println(" My guess is that you are thinking of a moose, but idc. ");
}
else if (questTwo.equals("no"))
{
System.out.println(" My guess is that you are thinking of a squirl, but idc.");
}
else
{
System.out.println(" Please restart");
}
}
else if (questOne.equals ("vegetable"))
{
System.out.println("Question 2) Is it bigger than a breadbox?");
questTwo = keyboard.next();
if (questTwo.equals ("yes"))
{
System.out.println(" My guess is that you are thinking of a watermellon, but idc. ");
}
else if (questTwo.equals("no"))
{
System.out.println(" My guess is that you are thinking of a carrot, but idc.");
}
else
{
System.out.println(" Please restart");
}
}
else if (questOne.equals ("mineral"))
{
System.out.println("Question 2) Is it bigger than a breadbox?");
questTwo = keyboard.next();
if (questTwo.equals ("yes"))
{
System.out.println(" My guess is that you are thinking of a car, but idc. ");
}
else if (questTwo.equals("no"))
{
System.out.println(" My guess is that you are thinking of a paperclip, but idc.");
}
else
{
System.out.println(" Please restart");
}
}
else
{
System.out.println("Please restart");
}
}
}
Picture of the output