Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import java.util.Random;
- import java.util.ArrayList;
- import java.util.HashMap;
- import java.util.HashSet;
- /**
- * This class implements a technical support system. it is the top level class in this project.
- * The support system communicatives 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 generate responses. It contains a loop
- * that repeatedly reads input and generates output untill the users wants to leaves.
- *
- * @author Ahmad Lamaul Farid
- * @version 12 November 2020
- */
- 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, untill 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("**** Welcome to the Dibel Technical Support System. ****");
- System.out.println();
- System.out.println("Please tell us about your problem.");
- System.out.println("Please type 'bye' to exit our system.");
- System.out.println();
- }
- /**
- * Print a good-bye message to the screen.
- */
- private void printGoodbye()
- {
- System.out.println("Nice talking to you. Bye......");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement