Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java ChatProgram Help!! Please help me out with this. https://gyazo.com/58dd66000524a1c92c75fd7b96d6b4ba https://gyazo.com/4c30a0050d1f168151686b8c827975ab https://gyazo.com/a638c8bea12990161a1d807506b54ae0 https://gyazo.com/ed18d521ac9fea4524e5eed9f984086c https://gyazo.com/3e85a65695192315c2686162333f6aa5 In this assignment, I have already provided a complete Main.java file.

Java ChatProgram Help!! Please help me out with this.

image text in transcribed https://gyazo.com/58dd66000524a1c92c75fd7b96d6b4ba

image text in transcribed https://gyazo.com/4c30a0050d1f168151686b8c827975ab

image text in transcribed https://gyazo.com/a638c8bea12990161a1d807506b54ae0

image text in transcribed https://gyazo.com/ed18d521ac9fea4524e5eed9f984086c

image text in transcribed https://gyazo.com/3e85a65695192315c2686162333f6aa5

In this assignment, I have already provided a complete Main.java file. You don't need to change the file. You can modify it while you are working and reset it before submitting Similar to last lab, you will be completing the class ChatBot. This time l already provided the public methods in the class. You will need to complete the implementation by thinking about the attributes of the class and the implementation of its constructor and methods. The key point is to think about the internal data structures to hold the questions, keywords and respective answers. You will need to use Java collections public ChatBot(String exitStatement, String defaultAnswer) The constructor takes two parameters. The first one is the statement used to exit the conversation, for example "Done!". The second is the answer for when the user enters something that does not match with any keyword "Hmmmmm." in our case public int getNumber0fQuestions This method returns the number of questions that the bot has. For example, after reading the file there have to be 13 questions public int getNumberOfAnswersC This method returns the number of answers that the bot stores public void addQuestion(String line) This method takes a string representing a question and adds it the bot list of questions public void addAnswer(String keyword, String answer This method takes two parameters a keyword and an answer and stores and associates the keyword with the answer. public boolean hasMoreQuestionsO If exitStatement was passed to the method answer in the past this method should return false, otherwise it returns true public String nextQuestionO This method pulls a question randomly from the list of the question and returns it public String answer(String response) This method takes a string representing user entry. It looks whether any of the keywords that have been added to the bot is contained in response. If so it retruns the associate answer. If not it returns the defaultAnswer Because of its conversational nature, this lab is better developed in eclipse. In ZyBooks you have to enter the answers (for questions you don't know) followed by Done!, program input (optional) family Java Donel

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Computer Aided Database Design

Authors: Antonio Albano, Valeria De Antonellis, A. Di Leva

1st Edition

0444877355, 978-0444877352

More Books

Students also viewed these Databases questions