import java.util.*;
/**
* Class mengimplementasikan technical support system
* Class utama untuk memanggil class lainnya
* @author Ghifari Astaudi Ukumullah
* @version 0.1 (2020.11.16)
*/
public class SupportSystem
{
private InputReader reader;
private Responder responder;
/*
* Creates a technical support system.
*/
public SupportSystem(){
reader = new InputReader();
responder = new Responder();
}
/**
* Start the technical support system. This will print a
* welcome message and enter into a dialog with the user.
* until the user ends the dialogs.
*/
public void start (){
boolean finished = false;
printWelcome();
while (!finished) {
HashSet<String> input = reader.getInput();
if (input.contains("bye")){
finished = true;
}
else{
String response = responder.generateResponse(input);
System.out.println (response);
}
}
printGoodbye();
}
/**
* Print a welcome message to the screen.
*/
public void printWelcome(){
System.out.println (
"Welcome to the Ghifari Technical Support System.");
System.out.println();
System.out.println ("Tolong beritahu masalah Anda");
System.out.println (
"Kami akan membantu masalah Anda.");
System.out.println (
"Tulis \'bye\' jika ingin mengakhiri");
}
/**
* Print a good-bye message to the screen.
*/
public void printGoodbye(){
System.out.println ("Senang mengobrol dengan Anda. Bye...");
}
}