Question
Artificial Intelligence elements in programming. Please write a program in Java with these requirement below. Ask a series of questions and based on the answer,
Artificial Intelligence elements in programming. Please write a program in Java with these requirement below.
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 appropriate levels of comments and indentions.
_Use the javac command to compile your code.
_Use the java command to evaluate the results of your code.
_Go beyond modifying your code to do something fresh. For example, validate user input. Or add some randomness to your story, (same input generates some different outputs)
_Code needs at least one loop and 3 switch statements!
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