PBO 7-Membuat TechSupport

Tugas 7 PBO_A
Pada kesempatan kali ini saya akan membuat simulasi TechSupport.
Disini saaya menggunakan 3 kelas yaitu :

  1. SupportSystem
  2. Responder
  3. InputReader

  • SupportSystem

 import java.util.Scanner;  
 /**  
  * Write a description of class SupportSystem here.  
  *  
  * @author (your name)  
  * @version (a version number or a date)  
  */  
 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 the DodgySoft Technical Support System.");  
     System.out.println();  
     System.out.println("Please tell us about your problem.");  
     System.out.println("We will assist you with any problem you might have.");  
     System.out.println("Please type 'bye' to exit our system.");  
   }  
   private void printGoodbye()  
   {  
     System.out.println("Nice talking to you. Goodbye!");  
   }  
 }  

  • Responder

 /**  
  * Write a description of class Responder here.  
  *  
  * @author (your name)  
  * @version (a version number or a date)  
  */  
 public class Responder  
 {  
   public Responder()  
   {  
   }  
   public String generateResponse()  
   {  
     return "That sounds interesting. Tell me more...";  
   }  
 }  

  • InputReader

 import java.util.Scanner;  
 /**  
  * Write a description of class InputReader here.  
  *  
  * @author Samuel Marcellinus  
  * @version 1.00  
  */  
 public class InputReader  
 {  
   private Scanner reader;  
   public InputReader()  
   {  
     reader = new Scanner(System.in);  
   }  
   public String getInput()  
   {  
     System.out.print("> ");  
     String inputLine=reader.nextLine();  
     return inputLine;  
   }  
 }  

Maka hasilnya kurang lebih akan seperti ini :


Comments

Popular posts from this blog

APSI 1 - Analisa Sistem Informasi Lazada

Tugas 3 PBKK