Question: Hi, so I need help with an assignment I'm doing called Magic 8 Ball. It requires that I use Strings and Switch statements. For this

Hi, so I need help with an assignment I'm doing called Magic 8 Ball. It requires that I use Strings and Switch statements.

For this assignment, I'm using the Java language. Thanks in advance!

Assignment:

In 1950, Mattell produced a toy shaped like the 8 ball in pool. On the bottom of the ball was a window that displayed a random message. Each time the ball was shaken the ball would provide a randomly different message, purportedly as a clairvoyant answer to a question posed.

The answers were as follows

1.It is certain

2. It is decidedly so

3. Without a doubt

4. Yes, definitely

5. You may rely on it

6. As I see it, yes

7. Most likely

8. Outlook good

9. Yes

10. Signs point to yes

11. Reply hazy try again

12. Ask again later

13. Better not tell you now

14. Cannot predict now

15. Concentrate and ask again

16. Don't count on it

17. My reply is no

18. My sources say no

19. Outlook not so good

20. Very doubtful

Directions for the assignment: Write a program that simulates the Magic 8 Ball. Prompt for a question, then provide a random answer selected from those given on the Magic 8 Ball. If the user does not enter a question, respond with the message The 8 Ball can only answer questions.. Questions end with a query mark. The program continues prompting until the user types No more questions for the Magic 8 Ball..

Sample Output

Ask the Magic 8 Ball: Will I get an A on this assignment?

The 8 Ball says: Dont count on it.

Ask the Magic 8 Ball: Should I use a switch statement?

The 8 Ball says: It is decidedly so.

Ask the Magic 8 Ball: No more questions for the Magic 8 Ball.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!