divider

Objective

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

  • icon Writing selection statements
  • icon Generating random numbers
divider

Tasks

  • icon Create a new project named application-2-1
  • icon Complete the following tasks:
    • icon 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.
    • icon Generate a random number. This number will correspond to a response.
    • icon Output a random response from the list of examples provided above. Make sure all possible responses are included in your program.
divider

Sample Output

Sample Output
Ask the Magic 8-Ball a question: Will I ace my exam? [Enter]
Magic 8-Ball says: Outlook not so good.

Begin Challenge