Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java programming , having troubles developing the program that allows the user to ask a question . Part 3: Magic Eight Ball The Magic Eight

Java programming , having troubles developing the program that allows the user to ask a question . image text in transcribed
Part 3: Magic Eight Ball The Magic Eight Ball was a children's toy developed in the 1960s that will reply with one of 20 answers after a question is posed. You will develop a program that allows the user to ask a question and you will provide a random answer To generate a random answer, you can use a random number from a random number generator. Java has a built-in random number generator in java.util Random. This random number generator will generate a number between 0 and n-1, where n is the input to its nextint(int) method. Random rand new RandomO: int num num = rand nextInt(); The result of the third statement will be a number between 0 and 19. We can then use a set of if statements to determine the answer we should return the user. For more information, as well as the 20 replies you should respond with, check out the Wikipedia page: Output random

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

Professional Microsoft SQL Server 2014 Administration

Authors: Adam Jorgensen, Bradley Ball

1st Edition

111885926X, 9781118859261

More Books

Students also viewed these Databases questions

Question

2. What potential barriers would you encourage Samuel to avoid?

Answered: 1 week ago