Assignemnt #47 Two More Questions
Code
///Tyler Hart
///period 5
///Two More Questions
///MoreQuestions.java
///10/1/2015
import java.util.Scanner;
public class MoreQuestions
{
public static void main( String[] args)
{
Scanner keyboard = new Scanner(System.in);
String QOne, QTwo;
System.out.println( "Question 1) Does it stay \"inside\" or \"outside\" or \"both\"?" );
QOne = keyboard.next();
System.out.println( "Question 2) Is it a living thing? \"yes\" or \"no\"?" );
QTwo = keyboard.next();
if (QOne.equals("inside") && QTwo.equals("yes"))
{
System.out.println("It's a houseplant, definitely a houseplant");
}
if (QOne.equals("inside") && QTwo.equals("no"))
{
System.out.println("It's a shower curtain, definitely a shower curtain");
}
if (QOne.equals("outside") && QTwo.equals("yes"))
{
System.out.println("It's a bison, definitely a bison");
}
if (QOne.equals("outside") && QTwo.equals("no"))
{
System.out.println("It's a billboard, definitely a billboard");
}
if (QOne.equals("both") && QTwo.equals("yes"))
{
System.out.println("It's a dog, definitely a dog");
}
if (QOne.equals("both") && QTwo.equals("no"))
{
System.out.println("It's a cell phone, definitely a cell phone");
}
}
}
Picture of the output