Magic 8 Ball

The Magic 8 Ball is a toy used for fortune-telling or seeking advice, manufactured by Mattel and developed in the 1950s.  It is often used in fiction, often for humour related to it giving very accurate, very inaccurate, or otherwise statistically improbable answers. You must design and write a program that recreates the Magic 8 Ball experience.

Possible Approach:

  • Create 8 possible answers with a mystic feel.
  • Print a welcome to the game.
  • Ask the user to ask for advice.
  • Print “shaking” four times (using only one line of code!)
  • Generate a random number between 1 and the maximum number of answers.
  • Use If, ElseIf, Else to select the an answer based on the random number.
  • Output the answer.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.