Assignment #44

Code

    ///Name: Cody Swain
    ///Period: 6
    ///Project Name: TwoQuestions
    ///File Name: TwoQuestions.java
    ///Date: 10/20/15
    
    import java.util.Scanner;
    
    public class TwoQuestions
    {
        public static void main( String[] args )
        {
            Scanner keyboard = new Scanner(System.in);
            String firstAnswer, secondAnswer;
            
            System.out.println("Two Questions!!");
            System.out.println("Think of an object, and I'll try to guess it.");
            System.out.println("Question 1) Is it an animal, vegetable, or mineral? ");
            
            
            firstAnswer = keyboard.next();
            
            
            
            if ( firstAnswer.equals("animal") )
            {
                System.out.println("Question 2) Is it bigger than a breadbox? ");
                secondAnswer = keyboard.next();
                
                if (secondAnswer.equals("yes") )
                {
                    System.out.println("My guess is that you are thinking of a moose." );
                }
                else if ( secondAnswer.equals("no") )
                {
                    System.out.println( "My guess is that you are thinking of a squirrel. " );
                }
                else
                    System.out.println(" Error " );
            }
            
            
            
            else if ( firstAnswer.equals("vegetable") )
            {
                System.out.println("Question 2) Is it bigger than a breadbox? ");
                secondAnswer = keyboard.next();
                
                if ( secondAnswer.equals("yes") )
                {
                    System.out.println("My guess is that you are thinking of a watermelon." );
                }
                else if ( secondAnswer.equals("no") )
                {
                    System.out.println( "My guess is that you are thinking of a carrot. " );
                }
                else
                    System.out.println(" Error " );
            }
            
            
            else if ( firstAnswer.equals("mineral") )
            {
                System.out.println("Question 2) Is it bigger than a breadbox? ");
                secondAnswer = keyboard.next();
                
                if (secondAnswer.equals("yes") )
                {
                    System.out.println("My guess is that you are thinking of a Camaro." );
                }
                else if ( secondAnswer.equals("no") )
                {
                    System.out.println( "My guess is that you are thinking of a paperclip. ");
                }
                else
                    System.out.println(" Error " );
            }
            
            
            System.out.println( "I would ask you if I am right but I actually don't care" );
            
        }
    }
            

        
    

Picture of the output

Assignment 44