Java Reference
In-Depth Information
Code 5.1
continued
The SupportSystem
source code
else {
String response = responder.generateResponse();
System.out.println(response);
}
}
printGoodbye();
}
/**
* Print a welcome message to the screen.
*/
private void printWelcome()
{
System.out.println(
"Welcome to the DodgySoft Technical Support System." );
System.out.println();
System.out.println( "Please tell us about your problem." );
System.out.println(
"We will assist you with any problem you might have." );
System.out.println(
"Please type 'bye' to exit our system." );
}
/**
* Print a good-bye message to the screen.
*/
private void printGoodbye()
{
System.out.println( "Nice talking to you. Bye..." );
}
}
Code 5.2
The Responder
source code
/**
* The responder class represents a response generator object.
* It is used to generate an automatic response to an input string.
*
* @author Michael K├Âlling and David J. Barnes
* @version 0.1 (2011.07.31)
*/
public class Responder
{
/**
* Construct a Responder - nothing to do
*/
 
Search WWH ::




Custom Search