NRP : 05111740000195
Kelas : PBO A
Source Code Support System :
public class SupportSystem
{
private InputReader reader;
private Responder responder;
public SupportSystem()
{
reader = new InputReader();
responder = new Responder();
}
public void start()
{
boolean finished = false;
printWelcome();
while(!finished) {
String input = reader.getInput();
if(input.startsWith("bye")) {
finished = true;
}
else {
String response = responder.generateResponse();
System.out.println(response);
}
}
printGoodbye();
}
private void printWelcome()
{
System.out.println(
"Welcome to fake Cortana");
System.out.println();
System.out.println("What Can I do for you? ");
System.out.println(
"Please tell us about your problem.");
System.out.println(
"type 'goodbye/bye' to end this program.");
}
private void printGoodbye()
{
System.out.println("Thanks for using me.");
}
}
Source Code Input Reader :
import java.util.Scanner;
public class InputReader
{
public String getInput()
{
Scanner input = new Scanner(System.in);
String in = input.nextLine();
return in;
}
}
Source Code Reader :
public class Responder
{
public Responder()
{
}
public String generateResponse()
{
return "zzzzz";
}
}
Tidak ada komentar:
Posting Komentar