Assignemnt #44 and Two Questions
Code
///Name: Dakota Donahue
///Period: 5
///Project Name: Two Questions
///File Name: TwoQuestions
///Date: 10/26/2015
import java.util.Scanner;
public class TwoQuestions
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
String type, size;
boolean tAnimal, tVegetable, tMineral, sBig, sSmall;
System.out.println( " Two Questions! " );
System.out.println( " Think of an object, and I'll try to guess it.\n ");
System.out.println( " Question 1) Is it an animal, vegetable or mineral? " );
type = keyboard.next();
System.out.println( " Question 2) Is it bigger than a breadbox? ( yes or no ) " );
size = keyboard.next();
tAnimal = type.equals("animal");
tVegetable = type.equals("vegetable");
tMineral = type.equals("mineral");
sBig = size.equals("yes");
sSmall = size.equals("no");
if ( tAnimal == true )
{
if ( sBig == true )
{
System.out.println( "You are thinking of a moose." );
System.out.println( " I would ask you if I'm right, but I don't actually care. " );
}
else if ( sSmall == true )
{
System.out.println( "You are thinking of a squirrel. " );
System.out.println( " I would ask you if I'm right, but I don't actually care. " );
}
else
{
System.out.println( " You broke the quiz, please try again in the correct format. " );
}
}
else if ( tVegetable == true )
{
if ( sBig == true )
{
System.out.println( " You are thinking of a watermelon. " );
System.out.println( " I would ask you if I'm right, but I don't actually care. " );
}
else if ( sSmall == true )
{
System.out.println( " You are thinking of a carrot. " );
System.out.println( " I would ask you if I'm right, but I don't actually care. " );
}
else
{
System.out.println( " You broke the quiz, please try again in the correct format. " );
}
}
else if ( tMineral == true )
{
if ( sBig == true )
{
System.out.println( " You are thinking of a camaro. " );
System.out.println( " I would ask you if I'm right, but I don't actually care. " );
}
else if ( sSmall == true )
{
System.out.println( " You are thinking of a paperclip. ");
System.out.println( " I would ask you if I'm right, but I don't actually care. " );
}
else
{
System.out.println( " You broke the quiz, please try again in the correct format. " );
}
}
else
{
System.out.println( " You broke the quiz, please try again in the correct format. " );
}
}
}