Assignment 44
Code
/// Name: Josh Bautista
/// Period: 6
/// Program Name: Two Questions
/// File Name: TwoQuestions.java
/// Date Finished: 12/10/2015
import java.util.Scanner;
public class TwoQuestions
{
public static void main ( String[] args )
{
Scanner keyboard = new Scanner(System.in);
String choice1, size;
System.out.println( " Hello get ready for a guessing game! ");
System.out.println( " Question 1) Is it an animal, vegetable, or mineral? ");
choice1 = keyboard.next();
if ( choice1.equals("animal") )
{
System.out.print("Is it bigger than a breadbox?");
size = keyboard.next();
if ( size.equals("no"))
{
System.out.print(" My guess is that you are thinking of a Moose ");
}
else if ( size.equals("yes"))
{
System.out.print(" My guess is that you are thinking of a squirrel ");
}
}
if ( choice1.equals("vegetable"))
{
System.out.print(" Is it bigger that a breabox?");
size = keyboard.next();
if ( size.equals("no"))
{
System.out.print(" My guess is that you are thinking of a carrot ");
}
else if ( size.equals("yes"))
{
System.out.print(" My guess is that you are thinking of a watermelon ");
}
}
if ( choice1.equals("mineral"))
{
System.out.print(" Is it bigger than a breadbox ");
size = keyboard.next();
if ( size.equals("no"))
{
System.out.print(" My guess is that you are thinking of paper ");
}
else if ( size.equals("yes"))
{
System.out.print(" My guess is that you are thinking of a Camaro ");
}
}
System.out.print(" I would ask you if I'm right, but I don't actually care. ");
}
}
Picture of Output