program techsupport - PBO A
Source Code :
1. Support System
2. Input Reader
3. Responder
1. 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("muleh")) {
finished = true;
}
else {
String response = responder.generateResponse();
System.out.println(response);
}
}
printGoodbye();
}
private void printWelcome()
{
System.out.println(
"Welcome to the siri kw premium");
System.out.println();
System.out.println("Onok problem opo lur? ");
System.out.println(
"ketik o 'muleh' gae metu.");
}
private void printGoodbye()
{
System.out.println("ati ati rek.");
}
}
2. Input Reader
import java.util.Scanner;
public class InputReader
{
public String getInput()
{
Scanner input = new Scanner(System.in);
String in = input.nextLine();
return in;
}
}
3. Responder
public class Responder
{
public Responder()
{
}
public String generateResponse()
{
return "iyo iyo";
}
}
Komentar
Posting Komentar