public class SupportSystem { private InputReader reader; private Responder respo
ID: 3570438 • Letter: P
Question
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 dialog.
*/
public void start()
{
boolean finished = false;
printWelcome();
while(!finished) {
String input = reader.getInput().trim().toLowerCase();
if(input.startsWith("bye")) {
finished = true;
}
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. We will assist you");
System.out.println("with any problem you might have. Please type 'bye'");
System.out.println("to exit our system.");
}
/**
* Print a good-bye message to the screen.
*/
private void printGoodbye()
{
System.out.println("Nice talking to you. Bye...");
}
}
import java.util.Scanner;
/**
* InputReader reads typed text input from the standard text terminal.
* The text typed by a user is then chopped into words, and a set of words
* is provided.
*
* @author Michael K
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 dialog.
*/
public void start()
{
boolean finished = false;
printWelcome();
while(!finished) {
String input = reader.getInput().trim().toLowerCase();
if(input.startsWith("bye")) {
finished = true;
}
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. We will assist you");
System.out.println("with any problem you might have. Please type 'bye'");
System.out.println("to exit our system.");
}
/**
* Print a good-bye message to the screen.
*/
private void printGoodbye()
{
System.out.println("Nice talking to you. Bye...");
}
}
import java.util.Scanner;
/**
* InputReader reads typed text input from the standard text terminal.
* The text typed by a user is then chopped into words, and a set of words
* is provided.
*
* @author Michael K
Explanation / Answer
@author Michael K
@author Michael K
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.