Assignment #47
Code
///jack newsom
///period 5
///program name TwoMoreQuestions
///filename TwoMoreQuestions.java
///date completed 9/28/15
import java.util.Scanner;
public class TwoMoreQuestions
{
public static void main( String[] args )
{
Scanner qbot = new Scanner(System.in);
String life, location;
Boolean bLife, bLocationA, bLocationB;
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.println("Question 1) Does it stay inside or outside or both?");
location = qbot.next();
System.out.println("Question 2) Is it a living thing?");
life = qbot.next();
bLocationA = location.equals("inside");
bLocationB = location.equals("outside");
bLife = life.equals("yes");
if ( bLocationA == true && bLife == true )
{
System.out.println("Then it's obviously a houseplant");
}
if ( bLocationA == true && bLife == false )
{
System.out.println("Then it's obviously a shower curtain! ");
}
if ( bLocationB == true && bLife == true )
{
System.out.println("Then it's obviously a bison!");
}
if ( bLocationB == true && bLife == false )
{
System.out.println("Then it's obviously a billboard!");
}
if ( bLocationA == false && bLocationB == false && bLife == true)
{
System.out.println("Then it's obviously a dog!");
}
if ( bLocationA == false && bLocationB == false && bLife == false )
{
System.out.println("Then it's obviously a cell phone!");
}
}
}
Picture of the output