Source Code untuk Class Nasabah :
- public class customer
- {
- private int no_urut_tel,no_urut_cs,jenis_layanan;
- public customer(int tampung)
- {
- jenis_layanan=tampung;
- }
- public int getNo_urut_tel(int tampung)
- {
- no_urut_tel=tampung;
- no_urut_tel++;
- return no_urut_tel;
- }
- public int getNo_urut_cs(int tampung)
- {
- no_urut_cs=tampung;
- no_urut_cs++;
- return no_urut_cs;
- }
- public int getJenis_layanan(int tampung, int count)
- {
- if(tampung==1)
- {
- System.out.println("\nSelamat Datang \nBank ITS");
- System.out.printf("\nNo Antrian : %d\n",getNo_urut_tel(count));
- System.out.println("\nLayanan : Teller\n");
- System.out.println(" Mohon tunggu sebentar\n");
- }
- else if(tampung==2)
- {
- System.out.println("\nSelamat Datang \nBank ITS");
- System.out.printf("\nNo Antrian : %d\n",getNo_urut_cs(count));
- System.out.println("\nLayanan : Customer Service\n");
- System.out.println(" Mohon tunggu sebentar\n");
- }
- else
- System.out.println("Format Salah");
- return tampung;
- }
- }
- import java.util.Scanner;
- public class main
- {
- public static void main(String[] args)
- {
- Scanner scan= new Scanner(System.in);
- int tampung=0,counttel=0,countcs=0;
- while(tampung>=0)
- {
- System.out.println("Masukkan jenis layanan :\n1. Teller \n2. Costumer Service \n Input :");
- tampung=scan.nextInt();
- customer x = new customer(tampung);
- if(tampung==1)
- {
- x.getJenis_layanan(tampung,counttel);
- counttel++;
- }
- else if(tampung==2)
- {
- x.getJenis_layanan(tampung,countcs);
- countcs++;
- }
- x.getNo_urut_tel(tampung);
- x.getNo_urut_cs(tampung);
- if(tampung!=1 & tampung !=2)
- break;
- }
- }
- }
Tidak ada komentar:
Posting Komentar