The precise implementation is up to you, but as one example, running this script:
Chatterbot chatters = new Chatterbot();
chatters.sayHello();
String response = chatters.waitForResponse();
while(response){
chatters.continueConversation();
if(response.equals("Goodbye!"){
chatters.sayGoodbye();
break;
}
}
should produce something like this, where the chatterbot is in black and the user is in blue.
"Hi there!"
"Hi!"
"Is that so?"
"Er, I think so?"
"Really?"
"Yes! I just said hello!"
"You wouldn't say?"
"Hrmph."
"I had no idea."
"Goodbye"
"Bye!"
(No need to follow this Chatterbot exactly; give yours its own speaking style!)