← Back
Code Challenge 9 - Magic 8-Ball
Introduction
The Magic 8-Ball is a fortune-telling toy. You ask the 8-ball a question, shake it up, and a response is shown in a little window. Some example responses include:
- It is certain.
- Without a doubt.
- Ask again later.
- Cannot predict now.
- Don’t count on it.
- Outlook not so good.
Skills to Practice
- Writing selection statements
- Generating random numbers
Challenge Tasks
- Create a console project named CodeChallenge9Magic8Ball.
- Complete the folowing tasks:
- Prompt the user to enter a question. You don’t need to save the question, because we don’t actually use their question in any meaningful way. We’re just giving the user hope.
- Generate a random number. This random number will match up to some response.
- Depending on the random number, output an answer from the examples above. Include them all in your program.
Sample Output