Support System
Nama : Timothyus Tanner
NRP : 05111740000103
Kelas : PBO - A
Source Code
1. Support System
/**
* Nama : Timothyus Tanner
* NRP : 05111740000103
* Kelas : PBO - A
*
*/
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("metu")){
finished = true;
}
else{
String response = responder.generateResponse();
System.out.println(response);
}
}
printGoodbye();
}
private void printWelcome(){
System.out.println("Selamat Datang");
System.out.println("Ngetik o sesuatu");
System.out.println("tulis 'metu' gawe metu tutuk kene");
}
private void printGoodbye(){
System.out.println("Bye bye :P");
}
}
2. InputReader
/**
* Nama : Timothyus Tanner
* NRP : 05111740000103
* Kelas : PBO - A
*
*/
import java.util.Scanner;
public class InputReader
{
public InputReader(){}
public String getInput(){
String input;
Scanner sc = new Scanner(System.in);
input = sc.nextLine();
sc.close();
return input;
}
}
3. Responder
/**
* Nama : Timothyus Tanner
* NRP : 05111740000103
* Kelas : PBO - A
*
*/
public class Responder
{
public Responder(){
}
public String generateResponse(){
return "Timo Ganteng";
}
}
Screenshoot
Tidak ada komentar:
Posting Komentar