Skip to content
Prev Previous commit
Next Next commit
Starting 04_02b
  • Loading branch information
Kathryn Hodge committed Jan 29, 2020
commit da271dbb7400d1d925a8703bed311204ea13fe07
9 changes: 2 additions & 7 deletions src/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,25 @@ public static void main(String args[]) {
String choiceTwo = "jupiter";
String choiceThree = "saturn";

String correctAnswer = choiceTwo;
String correctAnswer = choiceThree;

// Write a print statement asking the question
System.out.println(question);

// Write a print statement giving the answer choices
System.out.println("Choose one of the following: " +
choiceOne + ", " + choiceTwo + ", or " + choiceThree + ".");
choiceOne + ", " + choiceTwo + ", or " + choiceThree + ".")

// Have the user input an answer
Scanner scanner = new Scanner(System.in);
// Retrieve the user's input
String input = scanner.next();

// If the user's input matches the correctAnswer...
// then the user is correct and we want to print out a congrats message to the user.
if(correctAnswer.equals(input.toLowerCase())) {
System.out.println("Congrats! That's the correct answer");
} else {
System.out.println("You are incorrect. The correct answer is " + correctAnswer);
}
// If the user's input does not match the correctAnswer...
// then the user is incorrect and we want to print out a message saying that the user is incorrect as well as what the correct choice was.

}

}