← Back
Code Challenge 2.1 - Magic 8-Ball 🎱
Objective
Your task is to create a program that simulates a Magic 8-Ball game. Users can ask a question and receive a random response from the Magic 8-Ball.
Example Responses
- 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 Challenge 2-1.
- Prompt the user to enter a question. While the user’s input isn’t used in any calculation, it makes the interaction feel personal and engaging.
- Generate a random number. This number will correspond to a response.
- Output a random response from the list of examples provided. Make sure all possible responses are included in your program.
Sample Output
Ask the Magic 8-Ball a question: Will I ace my exam? [Enter]
Magic 8-Ball says: Outlook not so good.