Assignment 44, 20 Questions... Na just 2
Code
///Name: Stella Koliavas
///Period: 5
///Program Name: Questions
///File Name: Questions.java
///Date Finshed: 11/7/15
import java.util.Scanner;
public class Questions
{
public static void main (String [] args)
{
Scanner siri= new Scanner(System.in);
String type = "", box = "", yes = "", no="";
System.out.println("Think of an object and I'll guess it ");
System.out.print("It it an animal, vegetable or a mineral? ");
type = siri.next();
System.out.print("Is it bigger than a bread box? ");
box = siri.next();
if (type.equals("animal"))
{
if (box.equals("no"))
{
System.out.println("You're thinking of a squirrel");
}
if (box.equals("yes"))
{
System.out.println("You're thinking of an elephant");
}
}
if (type.equals("vegetable"))
{
if (box.equals("yes"))
{
System.out.println("You're thinking of a watermelon");
}
if (box.equals("no"))
{
System.out.println("You're thinking of a carrot");
}
}
if (type.equals("mineral"))
{
if (box.equals("yes"))
{
System.out.println("You're thinking of a white sketchy van");
}
if (box.equals("no"))
{
System.out.println("You're thinking of a paper clip");
}
}
}
}
Picture of the output