Assignment #47
Code
///Name: Cody Swain
///Period: 6
///Project Name: TwoQuestions2
///File Name: TwoQuestions2.java
///Date: 10/22/15
import java.util.Scanner;
public class TwoQuestions2
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
String firstAnswer, secondAnswer, Answer;
System.out.println( "TWO MORE QUESTIONS, BABY! \n " );
System.out.println( "Think of something and I'll try to guess it! \n " );
System.out.print( "Question 1) Does it stay inside or outside or both? " );
firstAnswer = keyboard.next();
System.out.print( "Question 2) Is it a living thing? " );
secondAnswer = keyboard.next();
if ( firstAnswer.equals( "inside" ) && secondAnswer.equals( "yes" ) )
{
System.out.println( "Then what else could you be thinking of besides a houseplant" );
}
if ( firstAnswer.equals( "inside" ) && secondAnswer.equals( "no" ) )
{
System.out.println( "Then what else could you be thinking of besides a shower curtain" );
}
if ( firstAnswer.equals( "outside" ) && secondAnswer.equals( "yes" ) )
{
System.out.println( "Then what else could you be thinking of besides a bison" );
}
if ( firstAnswer.equals( "outside" ) && secondAnswer.equals( "no" ) )
{
System.out.println( "Then what else could you be thinking of besides a billboard" );
}
if ( firstAnswer.equals( "both" ) && secondAnswer.equals ( "yes" ) )
{
System.out.println( "Then what else could you be thinking of besides a dog" );
}
if ( firstAnswer.equals( "both" ) && secondAnswer.equals ( "no" ) )
{
System.out.println( "Then what else could you be thinking of besides a cell phone" );
}
}
}
Picture of the output