Question: Artificial Intelligence elements in programming. Creating different outputs based on user input. Ask a series of questions and based on the answer, create an adventure
Artificial Intelligence elements in programming. Creating different outputs based on user input.
Ask a series of questions and based on the answer, create an adventure or story.
- Welcome the use and let them know what is about to happen.
- Use JOptionPane for input and output.
- Use String.format() for the output.
- Ask the user a series of questions. 10-15 questions with each answer being able to generate 1-3 sentences will build a nice size story.
- Build a story for that user to read.
- The story should be different based on the answers For example if the computer asks "How are you today?" the story takes a different turn for "Happy" that it would for "SAD"
- Allow the user to do the story again without leaving the program. They should get different results with different answers.
- Look at giving one or two answers with randomized results. (the same answer gets a different result)
- Print the story for the user to see.
- When they are ready to leave, thank the user for using the program.
The learning goal for this exercise is to use switch statements and loops to create a user input generated story.
- Use at least one loop and three switch statements. You will likely need more. Some decisions can be satisfied with IF statements.
- Use the java command to evaluate the results of your code.
IN JAVA
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
