Assignment #44

Code

///jack newsom
///period 5
///program TwoQuestions
///filename TwoQuestions.java
///date completed 9/25/15

import java.util.Scanner;

public class TwoQuestions
{
    public static void main( String[] args)
    {
        Scanner qbot = 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.");
        System.out.println("");
        
        System.out.println("Question 1) Is it animal, vegetable, or mineral?");
        type = qbot.next();
        
        System.out.println("");
        System.out.println("Question 2) Is it bigger than a breadbox? (y/n)");
        size = qbot.next();
        
        System.out.println();
        
        tAnimal = type.equals("animal");
        tVegetable = type.equals("vegetable");
        tMineral = type.equals("mineral");
        
        sBig = size.equals("y");
        sSmall = size.equals("n");
        
        if ( tAnimal == true)
        {
            if ( sBig == true ) 
            {
            System.out.println("My guess is you are thinking of a moose.");
            System.out.println("I would ask you if I'm right, but I don't really care.");
            }
            else if ( sSmall == true )
            {
            System.out.println("My guess is you are thinking of a squirrel. ");
            System.out.println("I would ask you if I'm right, but I don't really care.");
            }
            else
            {
                System.out.println("Whoops, you broke the quiz. Please try again.");   
            }
        }
        else if ( tVegetable == true )
        {
            if ( sBig = true ) 
            {
            System.out.println("My guess is you are thinking of a watermelon.");
            System.out.println("I would ask you if I'm right, but I don't really care.");
            }
            else if ( sSmall == true )
            {
            System.out.println("My guess is you are thinking of a carrot ");
            System.out.println("I would ask you if I'm right, but I don't really care.");
            }
            else
            {
                System.out.println("Whoops, you broke the quiz. Please try again.");   
            }
        }
        else if ( tMineral == true )
        {
            if ( sBig == true ) 
            {
            System.out.println("My guess is you are thinking of a Camaro.");
            System.out.println("I would ask you if I'm right, but I don't really care.");
            }
            else if ( sSmall == true )
            {
            System.out.println("My guess is you are thinking of a paper clip.");
            System.out.println("I would ask you if I'm right, but I don't really care.");
            }
            else
            {
                System.out.println("Whoops, you broke the quiz. Please try again.");   
            }
        }
        else
        {
            System.out.println("Welp, you broke the quiz. Congratulations.");
            System.out.println("Please rerun the program and try again.");
        }
    }
}  
    

Picture of the output

Assignment X