Assignemnt #47: Two More Questions
Code
/// Name: Cassie
/// Period: 6
/// Program Name: Two More Questions
/// File Name: twomorequestions.java
/// Date Finished: 11/17/2015
import java.util.Scanner;
class twomorequestions
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner( System.in );
String answerOne, answerTwo;
System.out.println( "TWO MORE QUESTIONS!" );
System.out.println( "Think of something and I'll try to guess it." );
System.out.println( "Question 1) Does it stay inside or outside or both?" );
System.out.print( "> " );
answerOne = keyboard.next();
if (answerOne.equals ("outside"))
{
System.out.println( " Question 2) Is it a living thing?" );
System.out.print( "> " );
answerTwo = keyboard.next();
if (answerTwo.equals ("yes"))
{
System.out.println( "Then what else could you be thinking of besides a bison." );
}
if (answerTwo.equals ("no"))
{
System.out.println( "Then what else could you be thinking of besides a billboard" );
}
}
if (answerOne.equals ("inside"))
{
System.out.println( " Question 2) Is it a living thing?" );
System.out.print( "> " );
answerTwo = keyboard.next();
if (answerTwo.equals ("yes"))
{
System.out.println( "Then what else could you be thinking of besides a houseplant" );
}
if (answerTwo.equals ("no"))
{
System.out.println( "Then what else coud you be thinking of besdies a shower curtain" );
}
}
if (answerOne.equals ("both"))
{
System.out.println( " Question 2) Is it a living thing?" );
System.out.print( "> " );
answerTwo = keyboard.next();
if (answerTwo.equals ("yes"))
{
System.out.println( "Then what else could you be thinking of besides a dog");
}
if (answerTwo.equals ("no"))
{
System.out.println( "Then what else could you be thinking of besides a cell phone");
}
}
}
}
Picture of the output