document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1.  
  2. /**
  3.  * This class implements a technical support system. It is
  4.  * the top-level class in this project. The support system
  5.  * communicates via text input/output in the text terminal.
  6.  * This class uses an object of class InputReader to read
  7.  * input from the user and an object of class Responder to
  8.  * generate responses.
  9.  * It contains a loop that repeatedly reads input and
  10.  * generates output until the user wants to leave.
  11.  *
  12.  * @author Daffa Tristan Firdaus
  13.  * @version 0.1 (11 November 2020)
  14.  */
  15.  
  16. import java.util.*;
  17. public class SupportSystem
  18. {
  19.     private InputReader reader;
  20.     private Responder responder;
  21.     /**
  22.      * Creates a technical support system.
  23.      */
  24.     public SupportSystem()
  25.     {
  26.         reader = new InputReader();
  27.         responder = new Responder();
  28.     }
  29.     /**
  30.      * Start the technical support system. This will print a
  31.      * welcome message and enter into a dialog with the user,
  32.      * until the user ends the dialog.
  33.      */
  34.     public void start()
  35.     {
  36.         boolean finished = false;
  37.         printWelcome();
  38.         while(!finished) {
  39.             HashSet<String> input = reader.getInput();
  40.             if(input.contains("bye")) {
  41.                 finished = true;
  42.             }else {
  43.                 String response = responder.generateResponse(input);
  44.                 System.out.println(response);
  45.             }
  46.         }
  47.         printGoodbye();
  48.     }
  49.     /**
  50.      * Print a welcome message to the screen.
  51.      */
  52.     private void printWelcome()
  53.     {
  54.         System.out.println(
  55.         "Welcome to the Technical Support System.");
  56.         System.out.println();
  57.         System.out.println("Please tell us about your problem.");
  58.         System.out.println(
  59.         "We will assist you with any problem you might have.");
  60.         System.out.println(
  61.         "Please type \'bye\' to exit our system.");
  62.     }
  63.     /**
  64.      * Print a good-bye message to the screen.
  65.      */
  66.     private void printGoodbye()
  67.     {
  68.         System.out.println("Nice talking to you. Goodbye");
  69.     }
  70. }
');