Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please use java to solve this Part 1: Fortune Teller Write a program that functions as a 'fortune teller' application. Essentially, it should read in
please use java to solve this
Part 1: Fortune Teller Write a program that functions as a 'fortune teller' application. Essentially, it should read in questions from the user and respond to the questions using vague, aphoristic phrases that will fit almost any situation. You know, kind of like a Magic 8 Ball or the very Fortune Sticks I use to make all my important life decisions. When a user asks a question, use a random number to decide which index to draw your fortune from. Example output (get creative and make up your own fortunes, mine are nothing special): Welcome to the All-Knowing, All-Seeing Java Fortune Teller What is your question? > Should I give a test this week? It is an auspicious time for such plans. Go forth with the confidence of the farmer who knows when the season in right. Do you have another question? > Should I give a quiz the first week back from break? The future is cloudy and unclear- ask again at a later time. There is something blocking my ability to read this outcome; perhaps it is better to tread carefully, like the ancient fox in the wolf's woods. Do you have another question? > No The best way to handle user input in this problem is to use a while loop that is controlled by what the user has typed in. For example, it could look like this: System.out.println("What is your question?"); String input scan.nextLine(); while (input.equals("No")) { F //do the random fortune telling // etc etc System.out.println("Do you have another question?"); input scan.nextLine(); Essentially, you read in the input while the input isn't equal to "No".
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