Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7739841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:37:24+00:00 2026-06-01T08:37:24+00:00

ChatBot Class Modification: Modify the reply() method of the ChatBot class to recognize additional

  • 0
ChatBot Class Modification:

Modify the reply() method of the ChatBot class to recognize additional words and phrases. 

Part 1: Everyone must complete this section.

When the userInput parameter value is:     The reply method should return:
how do I quit                           enter quit
how do I exit                           enter quit
how do I stop                           enter quit
how do I ____                           do you really want to do that
how are you                             I'm fine
how ______                              I don't know

Add two additional words or phrases to recognize and respond to.

ChatBot Client Modification:

Modify the ChatBot client application to loop until the end-user enters "quit".

Here is my service class
/

**
 * Java Chatbot Service class
 * @author Blake
 * 3/5/2012
 */

/**
  * Default constructor.
  */
public class Chatbot
{
   private String name; /** Users name */
    private String introbot; /** Name of the Chatbot */
    private String reply; /** Replies to the input of the string name and string introbot */

    /**
      * Constructs mutebot object
      * @param mutebow - returns name of mutebot
      */
    public Chatbot()
        {
            name = "MuteBot";
        }


    /**
     * Changes Name
     * @param name - new name
     */
    public void setName (String n)
    {
    name = n;
    }

    /**
     * Accesses name
     * @return a brand new name
     */
    public String getName()
    {
    return name;
    }

    /**
      * Accesses introbot
      * @return name of mutebot
      */
    public String introbot()
    {
    String intro = "Hello! My name is " + name;
    return intro;

    }

    /**
      * Accesses replay(String newuserinput)
      * @return introbot reply to user input
      */
    public String getreply(String newuserinput)
    {
       String reply = "I'm just learning to talk";

        if (newuserinput.equalsIgnoreCase("What"))
            reply = "Why do you ask?"; 
        else
           if (newuserinput.equalsIgnoreCase("Why") )
             reply = "Why Not";
        else
           if (newuserinput.equalsIgnoreCase("How"))
             reply = "I don't know!";
        else
           if (newuserinput.equalsIgnoreCase("Where") )
             reply = "Anne Arundel Community College";
        else
           if (newuserinput.equalsIgnoreCase("When"))
             reply = "Tomorrow";
        else
           if (newuserinput.equalsIgnoreCase("how do I quit"))
            reply = "enter quit";
        else
           if (newuserinput.equalsIgnoreCase("how do I exit"))
            reply = "enter quit";
        else
           if (newuserinput.equalsIgnoreCase("how do I stop"))
            reply = "enter quit";
        else
           if (newuserinput.equalsIgnoreCase("how are you"))
            reply = "I'm fine";
        else
           if (newuserinput.equalsIgnoreCase("how do you do"))
             reply = "I am doing well";
        else
           if (newuserinput.equalsIgnoreCase("how do I get out"))
             reply = "By going through the door";
        else
           if (newuserinput.indexOf("how do I" ) ==0)
            { String substring = newuserinput.substring(8);

            reply = "do you really want to do that" + substring;
            }
        else
           if (newuserinput.indexOf("how" ) ==0)
            { String substring = newuserinput.substring(10);


            reply = "I don't know" + substring ;
            }



        return reply;

    }
}

Here is my client/application class

/**
 * Java Chatbot Client class
 * @author Blake
 * 3/5/2012
 */

import java.util.Scanner;
public class ChatbotClient
{
   public static void main(String[] args)
    {
       Scanner input = new Scanner(System.in);

        Chatbot t = new Chatbot();
       System.out.print("What is your name? ");
       String name = input.nextLine();

         System.out.println(t.introbot());

       System.out.print(name + "> ");
       String reply = input.nextLine();

         System.out.println(t.getName() + "> " + t.getreply(reply));
         //while (reply < quit)
         /*{
            quit++
             i = i + 1

         }*/






    }
}

I don’t know what I am doing wrong with this part right here

Modify the ChatBot client application to loop until the end-user enters “quit”.

I am trying to create a while loop which will continue until user says quit.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T08:37:25+00:00Added an answer on June 1, 2026 at 8:37 am

    I think following code should work for your requirements:

    import java.util.Scanner;
    public class ChatbotClient
    {
       public static void main(String[] args)
        {
           Scanner input = new Scanner(System.in);
    
           Chatbot t = new Chatbot();
           System.out.print("What is your name? ");
           String name = input.nextLine();
    
           System.out.println(t.introbot());
    
           System.out.print(name + "> ");
           String reply = input.nextLine();
    
          while (!reply.equalsIgnoreCase("quit")){
            System.out.println(t.getName() + "> " + t.getreply(reply));
            System.out.print(name + "> ");
            reply = input.nextLine();
          }
         }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

ChatBot class: A chatbot is a computer program designed to simulate an intelligent conversation
i have this chatbox, and when users login i want it to send a
I am writing python chatbot that displays output through console. Every half second it
My aim is to write an intelligent ChatBot. He should save known informations likely
I am trying to set up a Bonjour (or Ahavi) chatbot for our helpdesk
What do you think are important pattern/temples to program. Like in a chatbot what
import cherrypy import os PORT = 8080 class intelServ: def index(self, botkey = None,
I have to do a final project for my computational linguistics class. We've been
I am interested to make a chatbot. My script is currently working fine with
public void responsePost(Editable editable) { TableLayout chatbox = (TableLayout)findViewById(R.id.chatbox); TableRow tr1 = new TableRow(this);

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.