Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- /**
- * This class implements a technical support system. It is the top-level class in this project.
- * The support system communicates via text input/output in the text terminal. This class uses
- * an object of class InputReader to read input from the user and an object of class Responder
- * to generates output until the user wants to leave.
- *
- * @author Muhammad Bagus Istighfar
- * @version 0.1 - 11 November 2020
- */
- public class SupportSystem
- {
- public InputReader reader;
- public 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 dialog.
- */
- 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.
- */
- private void printWelcome()
- {
- System.out.println("Selamat datang di ChatSkuy Bot System");
- System.out.println("Yuk share ceritamu, dan mulailah chat");
- System.out.println("Ketik 'bye' untuk mengakhiri bot system\n");
- }
- /**
- * Print a good-bye message to the screen.
- */
- private void printGoodbye()
- {
- System.out.println("Kamu sangat ramah. Semoga harimu menyenangkan!\n");
- System.out.println("^_^ Good Bye ^_^");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment