Assignemnt #47 and Two More Questions
Code
///Name: Ben Borlgin
///period: 6
///Program Name: Two more questions
///File Name: twoMoreQuestions.java
///Date Finished: 10/5/15
import java.util.Scanner;
public class twoMoreQuestions
{
public static void main( String[] args)
{
Scanner keyboard = new Scanner(System.in);
String Q1, Q2;
System.out.println("Two more questions.");
System.out.println(" ");
System.out.println("Think of something and I will guess it.");
System.out.println(" ");
System.out.println("Question 1: Does it belong inside or outside?");
System.out.println("Either 'inside' or 'outside' or 'both'.");
System.out.print(">");
Q1 = keyboard.next();
System.out.println("Is it a living thing?");
System.out.println("Either 'alive' or 'not alive'.");
System.out.print(">");
Q2 = keyboard.next();
if (Q1.equals("inside") && Q2.equals("alive"))
{
System.out.println("Then you are thinking of a houseplant.");
}
if (Q1.equals("inside") && Q2.equals("not alive"))
{
System.out.println("Then you are thinking of a shower curtain.");
}
if (Q1.equals("outside") && Q2.equals("alive"))
{
System.out.println("Then you are thinking of a bison.");
}
if (Q1.equals("outside") && Q2.equals("not alive"))
{
System.out.println("Then you are thinking of a billboard.");
}
if (Q1.equals("both") && Q2.equals("alive"))
{
System.out.println("Then you are thinking of a dog.");
}
if (Q1.equals("both") && Q2.equals("not alive"))
{
System.out.println("Then you are thinking of a cell phone");
}
}
}
Picture of the output