Assignemnt #47 and Two More Questions
Code
///Name: Daniel Tiffany-Appleton
///Period: 7
///Program Name: Two More Questions
///File Name: TwoMoreQuestions
///Date Finished: 10/16/15
import java.util.Scanner;
public class TwoMoreQuestions
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
String positionInSpace, livelihood;
boolean inside, outside, both, yes, no;
System.out.println( "TWO MORE QUESTIONS, BABY!" );
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 belong inside or outside or both? ");
positionInSpace = keyboard.next();
inside = positionInSpace.equals("inside");
outside = positionInSpace.equals("outside");
both = positionInSpace.equals("both");
System.out.print( "Question 2: Is it alive? ");
livelihood = keyboard.next();
yes = livelihood.equals("yes");
no = livelihood.equals("no");
if ( inside && yes)
{
System.out.println( "Houseplant" );
}
if ( inside && no)
{
System.out.println( "Shower Curtain" );
}
if ( outside && yes)
{
System.out.println( "Bison" );
}
if ( outside && no)
{
System.out.println( "Billboard" );
}
if ( both && yes)
{
System.out.println( "Dog" );
}
if ( both && no)
{
System.out.println( "Cell Phone" );
}
System.out.println( "Boom, got it right!" );
}
}
Picture of the output