A chatbot is an application that talks to the user. You're going to build an app that carries a simple conversation.
Open the challenge
Module 1 - Introduction to Java ->
2. Variables, open
1. Store each answer.
After each question, add code that picks up the user's answer and stores it.
Careful from the
nextLine()gets "skipped" if you put it ahead of
nextLong(). You can expect this behaviour when you try to pick up the user's favorite language.
You will understand why this happens when we cover Delimiters in the next section (Booleans and Conditionals).
The solution is to add a throwaway
scan.nextLine()before the "real"
2. Update each reply.
Update each reply with the user's answer.
3. Run your code.
Why is the cat scared?
The screaming cat appears when something's wrong or looks bad. In this case, the output is very messy. There should be a line of spacing between each answer and reply (see arrows).
4. Add a new line
Before every reply, add a new line.
Follow the comments to guide your code.