Assignment 47, Two More Questions
Code
///Name: Stella Koliavas
///Period: 5
///Program Name: Questions2
///File Name: Questions2.java
///Date Finshed: 11/16/15
import java.util.Scanner;
public class Questions2
{
public static void main (String [] args)
{
Scanner siri= new Scanner(System.in);
String where, alive;
System.out.println("Think of an object and I'll guess it ");
System.out.print("Does it belong inside, outside or both? ");
where = siri.nextLine();
System.out.print("Is it alive or dead? ");
alive = siri.nextLine();
if (where.equals("inside") && alive.equals("dead"))
{
System.out.println("You're thinking of a shower curtain");
}
if (where.equals("inside") && alive.equals("alive"))
{
System.out.println("You're thinking of a house plant");
}
if (where.equals("outside") && alive.equals("dead"))
{
System.out.println("You're thinking of a car");
}
if (where.equals("outside") && alive.equals("alive"))
{
System.out.println("You're thinking of Morgan Kaplan");
}
if ((where.equals("both")) && (alive.equals("alive")))
{
System.out.println("You're thinking of a cat");
}
if (where.equals("both") && alive.equals("dead"))
{
System.out.println("You're thinking of a cell phone");
}
}
}
Picture of the output