Created
January 3, 2021 00:07
-
-
Save HyrumDickinson/0c514c8da1dcbe121fdc38dd22af9b18 to your computer and use it in GitHub Desktop.
Experimental gist (what even is this thing?)
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 MultipleChoiceQuestionModifiable { | |
public static void main(String[] args) { | |
// this section provides the question content and may be modified | |
// modify the green inside the quotation marks to create a new question | |
// correctAnswer must be the same as one of the options | |
// options and correctAnswer must consist of a single lowercase word | |
String question = ("Who is the tallest Dickinson?"); | |
String optionA = ("caleb"); | |
String optionB = ("hyrum"); | |
String optionC = ("ammon"); | |
String optionD = ("nathanael"); | |
String correctAnswer = ("hyrum"); | |
// this section provides the question mechanics and should not be modified | |
System.out.println(question); | |
System.out.println(optionA + ", " + optionB + ", " + optionC + ", or " + optionD +"?"); | |
Scanner input = new Scanner(System.in); | |
String userAnswer = input.next(); | |
if (correctAnswer.equals(userAnswer.toLowerCase())) { | |
System.out.println("Good job! " + correctAnswer + " is the correct answer."); | |
} else { | |
System.out.println("Sorry, the correct answer was " + correctAnswer + ". Better luck next time!"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment