Created
June 10, 2018 03:06
-
-
Save jeffreybro/335a696c02964ad4176babb85be876ee to your computer and use it in GitHub Desktop.
TwoMoreQuestions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class TwoMoreQuestions | |
{ | |
public static void main (String []args) | |
{ | |
Scanner keyboard = new Scanner(System.in); | |
String intro1 = "TWO MORE QUESTIONS, BABY!"; | |
String intro2 = "Think of something and I'll try to guess it."; | |
String question1= "Question 1) Does it belong inside or outside or both?"; | |
String question2= "Question 2) Is it alive?"; | |
String option1 = "houseplant"; | |
String option2 = "bison"; | |
String option3 = "dog"; | |
String option4 = "shower curtain"; | |
String option5 = "billboard"; | |
String option6 = "cell phone"; | |
String conclusion = "Then what else could you be thinking of besides a "; | |
System.out.println (intro1); | |
System.out.println (intro2); | |
System.out.println (); | |
System.out.println(question1); | |
String firstAnswer= keyboard.next(); | |
System.out.println(); | |
System.out.println(question2); | |
String secondAnswer= keyboard.next(); | |
if ((firstAnswer.equals("inside")) && (secondAnswer.equals("yes"))); | |
{ | |
System.out.println(conclusion + option1); | |
} | |
if ((firstAnswer.equals("inside")) && (secondAnswer.equals("no"))); | |
{ | |
System.out.println(conclusion + option4); | |
} | |
if ((firstAnswer.equals("outside")) && (secondAnswer.equals("yes"))); | |
{ | |
System.out.println(conclusion + option2); | |
} | |
if ((firstAnswer.equals("outside")) && (secondAnswer.equals("no"))); | |
{ | |
System.out.println(conclusion + option5); | |
} | |
if ((firstAnswer.equals("both")) && (secondAnswer.equals("yes"))); | |
{ | |
System.out.println(conclusion + option3); | |
} | |
if ((firstAnswer.equals("both")) && (secondAnswer.equals("no"))); | |
{ | |
System.out.println(conclusion + option6); | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you /u/bas1212. I got rid of the semi-colons at the end of the if statements and that did resolve the problem. I appreciate your helpfulness.