Question
Use ONLY if, else if, and else (conditionals) as well as do-while loops in JAVA. 8.2: Trivia tester In this problem, you will write a
Use ONLY if, else if, and else (conditionals) as well as do-while loops in JAVA.
8.2: Trivia tester
In this problem, you will write a program that asks the user a trivia question and tells them whether or not they got it right. First, print the question and answer choices, then prompt for a guess. Then, display a message in response to the user's guess telling them if it was correct. The examples and test cases will tell you what question to ask.
Be sure to match the expected format and pass all the test cases. Don't forget to use good style in your solution and add implementation comments where appropriate.
Example input/output 1:
Trivia time! In what year did TSU officially change its name to Tennessee State University? 1. 1955 2. 1962 3. 1968 4. 1991 Enter a guess (1-4): 3 Correct!
Example input/output 2:
Trivia time! In what year did TSU officially change its name to Tennessee State University? 1. 1955 2. 1962 3. 1968 4. 1991 Enter a guess (1-4): 1 Incorrect. The correct answer was 3 (1968).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started