Question: Java programming , having troubles developing the program that allows the user to ask a question . Part 3: Magic Eight Ball The Magic Eight
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
Get step-by-step solutions from verified subject matter experts
