Assignment #47 and TwoMoreQuestions
Code
/// Name: Jason Kim
/// Period: 7
/// Program Name: TwoMoreQuestions
/// File Name: TwoMoreQuestions.java
/// Date Finished:10/9/15
import java.util.Scanner;
public class TwoMoreQuestions
{
public static void main (String[] args)
{
Scanner keyboard = new Scanner(System.in);
String Q1, Q2;
Boolean condition1, condition2, condition3, condition4, condition5, condition6;
System.out.println("TWO QUESTIONS, BABY!");
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?\n> ");
Q1 = keyboard.next();
System.out.print("\nQuestion 2) Is it a living thing?\n> ");
Q2 = keyboard.next();
condition1 = (Q1.equals("outside") && Q2.equals("yes"));
condition2 = (Q1.equals("outside") && Q2.equals("no"));
condition3 = (Q1.equals("inside") && Q2.equals("yes"));
condition4 = (Q1.equals("inside") && Q2.equals("no"));
condition5 = (Q1.equals("both") && Q2.equals("yes"));
condition6 = (Q1.equals("both") && Q2.equals("no"));
System.out.println();
if (condition1)
{
System.out.println("Obviously you are thinking of a bison.");
}
if (condition2)
{
System.out.println("Obviously you are thinking of a billboard.");
}
if (condition3)
{
System.out.println("Then what else could you be thinking of besides a houseplant?");
}
if (condition4)
{
System.out.println("Then what else could you be thinking of besides a shower curtain?");
}
if (condition5)
{
System.out.println("Obviously you are thinking of a dog!");
}
if (condition6)
{
System.out.println("Obviously you are thinking of a cell phone!");
}
}
}
Picture of the output