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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!