Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Rob, Carlos Coronel

3rd Edition

0760049041, 978-0760049044

More Books

Students also viewed these Databases questions

Question

Explain the purpose of a business plan.

Answered: 1 week ago

Question

KEY QUESTION Refer to the table in question

Answered: 1 week ago