Assignment #44 Twenty Questions… Na Just Two
Code
///Name: Ian Grant
///Period:5
///Project Name: Twenty Questions… Na Just Two
///File Name:TwoQues.java
///10/29/15
import java.util.Scanner;
public class TwoQues
{
public static void main(String[] args)
{
String q,w;
Scanner stuff =new Scanner(System.in);
System.out.println("TWO QUESTIONS!!");
System.out.println("Think of an object, and I'll try to guess it.");
System.out.println("Questions 1: Is it an animal, vegetable, or mineral?");
q=stuff.next();
System.out.println();
System.out.println("Question 2: Is it bigger than a breadbox?");
w=stuff.next();
if (q.equals("animal"))
{
if (w.equals("yes"))
{
System.out.println("My guess is that it's the rare man-eating squirrel.");
}
else if(w.equals("no"))
{
System.out.println("My guess is that it's a tiny moose.");
}
}
else if(q.equals("vegetable"))
{
if(w.equals("yes"))
System.out.println("My guess is that it's a carrot.");
else if(w.equals("no"))
System.out.println("My guess is that it's a giant pumbkin");
}
else if(q.equals("mineral"))
{
if (w.equals("yes"))
System.out.println("My guess is that it's a baby Terminator");
else if(w.equals("no"))
System.out.println("My guess is that it's Arnold the Terminator");
}
}
}
Output