Assignemnt #47
Code
/// Name: Connor Siri
/// Period: 7
/// Program Name: Two
/// File Name: Two.java
/// Date Finished: 10/15/2015
import java.util.Scanner;
class Two{
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
String Q1, Q2, answer;
answer = "";
System.out.println("Two more questions for you!!!");
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 stay inside or outside or both? ");
Q1 = keyboard.next();
System.out.print("Question 2) Is it a living thing? ");
Q2 = keyboard.next();
System.out.println("");
if (Q1.equals("inside") && Q2.equals("yes"))
{
answer = "houseplant";
}
if (Q1.equals("inside") && Q2.equals("no"))
{
answer = "shower curtain";
}
if (Q1.equals("outside") && Q2.equals("yes"))
{
answer = "bison";
}
if (Q1.equals("outside") && Q2.equals("no"))
{
answer = "billboard";
}
if (Q1.equals("both") && Q2.equals("yes"))
{
answer = "dog";
}
if (Q1.equals("both") && Q2.equals("no"))
{
answer = "cell phone";
}
System.out.println("You were thinking of a " + answer);
}
}
Picture of the output