Assignment #47 and Two More Questions
Code
/// Name: Ali Kurland
/// Period: 6
/// Program Name: Two More Questions
/// File Name: TwoMoreQuestions.java
/// Date Finished: 10/1/2015
import java.util.Scanner;
public class TwoMoreQuestions
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
String answer1, answer2;
answer2 = "";
System.out.println( "Let's play two questions!" );
System.out.println( " " );
System.out.println( "Think of something and I'll try to guess it!" );
System.out.println( " " );
System.out.print( "Question 1) Does it stay inside or outside or both? " );
answer1 = keyboard.next();
if ( answer1.equals("outside") || answer1.equals("inside") || answer1.equals("both") )
{
System.out.print( "Question 2) Is it a living thing? " );
answer2 = keyboard.next();
}
if ( answer1.equals("outside") && answer2.equals("yes") )
{
System.out.println( "You must be thinking of a lion!" );
}
if ( answer1.equals("outside") && answer2.equals("no") )
{
System.out.println( "You must be thinking of a cloud!" );
}
if ( answer1.equals("inside") && answer2.equals("yes") )
{
System.out.println( "You must be thinking of a hamster!" );
}
if ( answer1.equals("inside") && answer2.equals("no") )
{
System.out.println( "You must be thinking of a computer!" );
}
if ( answer1.equals("both") && answer2.equals("yes") )
{
System.out.println( "You must be thinking of a person!" );
}
if ( answer1.equals("both") && answer2.equals("no") )
{
System.out.println( "You must be thinking of a shoe!" );
}
}
}
Picture of the output