please use java to solve this Part 1: Fortune Teller Write a program that functions as a
Fantastic news! We've Found the answer you've been seeking!
Question:
please use java to solve this
Transcribed Image Text:
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". 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".
Expert Answer:
Posted Date:
Students also viewed these programming questions
-
Determine whether the given functions are even, odd, or neither. a. x sin(x) c. x cos(x) e. x sin(x) + x sin(x) f. x sin(x) + x cos(x) even h. x sin(x) + x cos(x) j. x cos (x) + x cos(x) b. x sin(x)...
-
Why should we be interested in residual stress developed in parts made by the forming process described in this chapter?
-
Pink Ink, Inc. has two products and two overhead cost pools: Required: A) Using direct labor hours as the allocation base, what is the overhead rate for Materials Handling overhead? B) What is the...
-
The following information for Great Oaks Furniture, a retail furniture and design firm, relates to Exercises 6 through 11. Perform a vertical analysis of the balance sheets and income statements for...
-
A plane wall of thickness L = 0.1 m experiences uniform volumetric heating at a rate q. One surface of the wall (x = 0) is insulated, while the other surface is exposed to a fluid at Too = 20C, with...
-
QS 16-8 (Algo) Computing cash from asset sales LO P3 The following information is from Ellerby Company's comparative balance sheets. At December 31 Current Year Prior Year Furniture $ 148, 500 $ 206,...
-
The external debt problem of African countries is now recognized as a serious global economic issue. A number of papers on the subject, including studies by Humphreys and Underwood (1988), Mistry...
-
How do individual differences in personality traits, cognitive styles, and motivational patterns influence employee behavior, decision-making processes, and job performance within organizations, and...
-
Income Statement FY20 FY21 Sales Cost of Goods Sold 11,280,000,000 13,108,000,000 5,076,000,000 5,899,000,000 Other Expenses 4,512,000,000 5,243,000,000 Depreciation 903,000,000 1,050,000,000...
-
How do emerging trends in organizational behavior research, such as the study of emotional intelligence, mindfulness practices, and diversity and inclusion initiatives, contribute to the development...
-
How have sales order processes through the SAP ERP system changed the organization in relation to business? Explains the production process of a company through the use of SAP ERP. Mention five...
-
Rings Company has three product lines, A, B, and C. The following financial information is available: Item Sales Product Line A Product Line B Product Line C $ 42,000 $ 75,000 $ 18,000 Variable costs...
-
Richard Co has successfully built a practice that services small businesses by providing accounting related services. Richard Co will provide free training and initial implementation of accounting...
-
Consider the combustion of methanol below. If 64 grams of methanol reacts with 160 grams of oxygen, what is the CHANGE in volume at STP. 2CH3OH(g) + 3O2(g) 2CO2(g) + 4H2O(1) The volume decreases by...
-
How can the location of a home affect insurance costs?
-
Why do some insurance companies offer discounts to drivers who install security devices in their vehicles?
-
Malcolm wants to buy an expensive sportutility vehicle. However, his mechanic has warned him that the replacement parts for the vehicle that he wants are costly. His friend Ishiro is on a tight...
Study smarter with the SolutionInn App