Question: /* * Replace Base with your last name in the file and class. * Plan out what you want your chatbot to do: * 1.

/* * Replace Base with your last name in the file and class. * Plan out what you want your chatbot to do: * 1. what will happen if the user says nothing? * 2. what keywords are you going to look for and respond to? * 3. how are you going to steer the conversation so that it: * a. stays on track * b. allows you to connect with the users through conversation and respond to keywords * 4. what if the user responds with something you do not recognize * a. could you do a random set of responses * b. could you do a stock response to goad them into a subject you can respond to? * 5. when looking for a specific response from the user, you should use a method to find what you need to respond to * a. I have provided two findKeyword methods that you can use, base yours on, or see how mine works. * * MY Sample Run that keys on I dream of, princess, prince, etc.: Hello, I am Maggie the Chatbot, how are you? >> I am well, and you? I am fine. What would you like to talk about today? >> I dream of Unicorns Why do you dream about Unicorns? >> Maybe because I want to be a princess? You've piqued my interest, a fairy or royal princess? >> A fairy princess would be great. Tell me more. */ public class MagpieBase { public String getGreeting(){ //Create your own greeting return "<>"; } public String getResponse(String statement) { String response = ""; return response; } //overloaded findKeyword method requiring the statement, goal word/phrase, //and the starting position, which is used to select this method private int findKeyword(String statement, String goal, int startPos){ String phrase = statement.toLowerCase().trim();

int psn = phrase.indexOf(goal.toLowerCase()); while (psn >= 0) { String before = " ", after = " "; if (psn > 0){ before = phrase.substring (psn - 1, psn).toLowerCase(); } if (psn + goal.length() < phrase.length()){ after = phrase.substring(psn + goal.length(), psn + goal.length() + 1).toLowerCase(); } if (((before.compareTo ("a") < 0 ) || (before.compareTo("z") > 0)) && ((after.compareTo ("a") < 0 ) || (after.compareTo("z") > 0))){ return psn; } psn = phrase.indexOf(goal.toLowerCase(), psn + 1); } return -1; } //simple findKeyword method requiring the statement and a goal word //and returns the result of true/false from the overloaded findKeyword above private int findKeyword(String statement, String goal){ return findKeyword (statement, goal, 0); } }

Error: Main method not found in class MagpieBase, please define the main method as: public static void main(String[] args) or a JavaFX application class must extend javafx.application.Application.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!