Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Coding Help.. I'm so lost. Main.java file is already completed. Just need chatbot code https://gyazo.com/260d8f26ebcd414d450c00d195eb1bd8 https://gyazo.com/cd5e683886eb0ec755e322d1b9f39d95 https://gyazo.com/82b2c7982bec9440112bad9c95eb5330 https://gyazo.com/beae7c7029c704f1e384dcd478526036 https://gyazo.com/827ab2611feef04840ffc9c618744ddf Similar to last lab, you

Java Coding Help.. I'm so lost.

Main.java file is already completed. Just need chatbot code

image text in transcribed https://gyazo.com/260d8f26ebcd414d450c00d195eb1bd8

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

image text in transcribed https://gyazo.com/82b2c7982bec9440112bad9c95eb5330

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

image text in transcribed https://gyazo.com/827ab2611feef04840ffc9c618744ddf

Similar to last lab, you will be completing the class ChatBotThis time I 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 getNumberOFQuestions 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 getNumberOf Answers 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 hasMoreQuestions If exitStatement was passed to the method answer in the past this method should return false, otherwise it returns true public string nextQuestion 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 Donel, Enter program input (optional) family 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

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 19 21 2012 Proceedings Part 3 Lnai 7198

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284922, 978-3642284922

More Books

Students also viewed these Databases questions