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 - Java Tutorial
From the course: Learning Java 11
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Mapping out program control flow3m 57s
-
(Locked)
Operators in Java2m 26s
-
(Locked)
Decision-making with if in Java4m 8s
-
(Locked)
Understanding scope in Java1m 39s
-
(Locked)
While loops (conceptually)1m 53s
-
(Locked)
While loops in Java3m 19s
-
(Locked)
Challenge: Multiple choice2m 22s
-
(Locked)
Sample solution: Multiple choice5m 1s
-
(Locked)
-
-
-
-