From the course: Learning Java 11

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Challenge: Multiple choice

Challenge: Multiple choice - Java Tutorial

From the course: Learning Java 11

Start my 1-month free trial

Challenge: Multiple choice

(bubbly music) - [Instructor] It's time to practice your control flow skills with this coding challenge. Be sure to use the tools you've learned about so far, including if statements, while loops, variables, and input-output. For this challenge, you will implement a single multiple-choice question in Java. You will come up with a question as well as three possible answer choices. One of these choices should be the correct answer. Using your knowledge of control flow and input and output, you will ask the user the question as well as provide the possible answer choices. The user will respond with one of these choices. If the user is correct, we will print out a congratulations message. If the user is incorrect, we will print out that the user is incorrect, as well as what the correct answer choice is. We've set up a few things for you in the code, so let's walk through what we have so far. First, we have four string variables. The first should contain the question. You will have to…

Contents