Assignemnt #47

Code


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

import java.util.Scanner ;
public class dosmas
{
	public static void main( String[] args )
	{
        Scanner keyboard = new Scanner(System.in);
        
        String q1, q2, thing;
        thing = "";
        
        System.out.println( "Think of something and I'll try to guess it!!!!" );
        System.out.println( "" );
        System.out.println( "Question 1) Does it stay 'inside' or 'outside' or 'both'?" );
        System.out.print( "> " );
        q1 = keyboard.next();
        System.out.println( "" );
        System.out.println( "Question 2) Is it a living thing? 'yes' / 'no'" );
        System.out.print( "> " );
        q2 = keyboard.next();
        
        if ( q1.equals("inside") ) {
            if ( q2.equals("yes") ) {
             thing = "houseplant";   
            }
            if ( q2.equals("no") ) {
             thing = "shower_curtain";   
            }
        }
        
        if ( q1.equals("outside") ) {
            if ( q2.equals("yes") ) {
             thing = "bison";   
            }
            if ( q2.equals("no") ) {
             thing = "billboard";   
            }
        }
        
        if ( q1.equals("both") ) {
            if ( q2.equals("yes") ) {
             thing = "dog";   
            }
            if ( q2.equals("no") ) {
             thing = "cellphone";   
            }
        }
        System.out.println( "I think you are thinking of a " + thing + "!!!" );
        
    }
}

    


    

Picture of the output

Assignment 3
BACK HOME NEXT