Assignemnt #47 and TwoMoreQuestions
Code
/// name: Leila Ordukhani
/// period: 6
/// program name: Thirty-Six Program
/// file name: TwoMoreQuestions.java
/// date finished: 10/28/15
import java.util.Scanner;
public class TwoMoreQuestions
{
public static void main(String[] args)
{
String response1, response2, response3, response4;
Scanner keyboard = new Scanner(System.in);
System.out.println("Two More Questions!");
System.out.println(" ");
System.out.println("Think of something and I'll try to guess it.");
System.out.print("Question 1: Does it stay inside or outside or both?");
response1 = keyboard.next();
if (response1.equals("inside"))
{
System.out.print("Is it a living thing?");
response2 = keyboard.next();
if (response2.equals("yes"))
{
System.out.println("You are obviously thinking of a house mouse.");
if (response2.equals("no"))
{
System.out.println("You are thinking of a chair.");
}
}
}
else if (response1.equals("outside"))
{
System.out.print("Is it a living thing?");
response3 = keyboard.next();
if (response3.equals("yes"))
{
System.out.println("You are thinking of a python.");
if (response3.equals("no"))
{
System.out.println("You are thinking of a firepit.");
}
}
}
else if (response1.equals("both"))
{
System.out.print("Is it a living thing?");
response4 = keyboard.next();
if (response4.equals("yes"))
{
System.out.println("It is a cat.");
if (response4.equals("no"))
{
System.out.println("It is a shoe.");
}
}
}
}
}
Picture of the output