Question
JAVA Requirements 1. Create an application that will generate a fortune (prediction) for the user. 2. The application will allow the user to input data.
JAVA
Requirements
1. Create an application that will generate a fortune (prediction) for the user. 2. The application will allow the user to input data. 3. The application will display a fortune based on the input data. 4. The application will validate the data. 5. The application will allow the user to generate another fortune without having to restart the program or allow the user to end the program. Menus
Menus 1-2 through 1-5 are displayed one question at a time.
------------------------------------------------------------------------------------------------------------- Welcome, I am FrogDini, the fortune telling amphibian. I can tell your future if you only answer a few questions. What type of fortune do you want? 1. Romance 2. Wealth 3. Health 4. Fame
Enter the selection number here: ------------------------------------------------------------------------------------------------------------- Figure 1-1: Top (Opening) Menu
------------------------------------------------------------------------------------------------------------- What city were you born in? What is the most romatic color? What is your favorite name? What is your job? Enter a letter? What is your favorite hobby? Enter a number? ------------------------------------------------------------------------------------------------------------- Figure 1-2: Romance Menu
------------------------------------------------------------------------------------------------------------- What city do you like best? What color is your mothers hair? What is your favorite teacher's first name? Name a high paying occupation? Enter your second favorite letter? What is your favorite hobby? Enter your fifth favorite number? ------------------------------------------------------------------------------------------------------------- Figure 1-3: Wealth Menu
------------------------------------------------------------------------------------------------------------- What city do you think has the most celebrities? What do you think is the most famous color? What do you think is the most common name? What job do you think makes people famous? Enter your least favorite letter? What do you think famous people do as a hobby? Enter your least favorite number? ------------------------------------------------------------------------------------------------------------- Figure 1-4: Fame Menu
------------------------------------------------------------------------------------------------------------- What do you think is the healthist city in the world? What is the color of your car? What is your doctor's first name? What do you think is the healthyist job? Enter your third favorite letter? What is your favorite hobbie? Enter your fifth favorite number? ------------------------------------------------------------------------------------------------------------- Figure 1-5: Health Menu
------------------------------------------------------------------------------------------------------------- [Display computed fortune] Do you want to continue? ------------------------------------------------------------------------------------------------------------- Figure 1-6: Fortune Menu
Data Storage
Data for the fortune teller application will be held in arrays. The data will not be held after the application is exited. The arrays are listed below:
Quotes this array holds the first half of the generated fortune. Answers this array holds the data input by the user
Methods and Variables
The methods that are included in this application are all defined in the same class. They are also all static methods and variables.
Methods: main() topMenu() romanceMenu() wealthMenu() fameMenu() healthMenu() romanceFortune() wealthFortune() fameFortune() healthFortune() fillInArray()
Variables choice - String answers ArrayList
Design
The application is designed to produce a fortune. The main() method handles the process flow. The pseudo code for that process flow is listed below:
1. Start program 2. Initialize loop variable 3. Begin loop 4. Display opening menu 5. Retrieve users answer about the type of fortune wanted. 6. Use if statement to determine which question menu to display 7. Retrieve the answers from the user 8. Finish filling in the answer array with a new number, letter, and name. 9. Use if statement to determine which fortune to displayed 10. After the fortune is displayed, clear the answer array 11. Ask the user if they want to continue. If yes, loop back to step 3 and continue. If no, exit the program.
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