Answered step by step
Verified Expert Solution
Question
1 Approved Answer
java programming Create a program named Magic8Ball In the main method, create a loop that continually asks the user to type a question. If the
java programming
Create a program named Magic8Ball In the main method, create a loop that continually asks the user to type a question. If the user enters a blank question ("), exit the loop. Otherwise, call a method named getAnswer which returns a String containing the answer to the user's question. Print that answer and prompt for another question. In the getAnswer method, generate a random integer in the range of 1 to 10. Using if statements, return one of ten possible answers corresponding to the random number. You can make the answer text. Sample user entered value 8 SAMPLE OUTPUT: $ java Magic8Bal.1 I AM THE MAGIC 8 BALL Ask me a question about your future: What is the meaning of life? Cannot predict now Ask me a question about your future: Will I have great riches? Concentrate and ask again Ask me a question about your future: Will I become wealthy? Outlook not so good Ask me a question about your future
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started