Assignemnt #44

Code


 /// Name: Daniel Nguyen
 /// Period: 6
 /// Program Name: size Program
 /// File Name: size.java
 /// Date Finished: 9/9/2015

import java.util.Scanner ;
public class size
{
	public static void main( String[] args )
	{
        Scanner keyboard = new Scanner(System.in);
        
        String q1, q2;
        
         System.out.println( "Think of an object, and I'll try to guess it." );
         System.out.println( "Question 1) Is it an animal, vegitable, or mineral?" );
            q1 = keyboard.next();
        
        if ( q1.equals("animal") ) {
        System.out.println( "Question 2) Is it bigger than a breadbox?" );
             q2 = keyboard.next();
            if ( q2.equals("yes") ) {
         System.out.println( "My guess is that 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 ( q2.equals("no") ) {
          System.out.println( "My guess is that you are thinking of a squirrel." );   
         System.out.println( "I would ask you if I'm right, but I don't actually care." );
        }
        }
         
        else if ( q1.equals("vegitable") ) {
        System.out.println( "Question 2) Is it bigger than a breadbox?" );
              q2 = keyboard.next();
            if ( q2.equals("yes") ) {
         System.out.println( "My guess is that 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 ( q2.equals("no") ) {
          System.out.println( "My guess is that you are thinking of a carrot." );   
         System.out.println( "I would ask you if I'm right, but I don't actually care." );
        }
        }
        
        else if ( q1.equals("mineral") ) {
        System.out.println( "Question 2) Is it bigger than a breadbox?" );
              q2 = keyboard.next();
            if ( q2.equals("yes") ) {
          System.out.println( "My guess is that 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 ( q2.equals("no") ) {
          System.out.println( "My guess is that you are thinking of a paper clip." );   
         System.out.println( "I would ask you if I'm right, but I don't actually care." );
        }
        }
  
        
        
      
    }
}


    

Picture of the output

Assignment 3
BACK HOME NEXT