Tuesday, January 30, 2018

CONTOH PROGRAM SEDERHANA HITUNG GAJI PEGAWAI DENGAN JAM KERJA MENGGUNAKAN JAVA

Tags



Skrip dalam Java : 


public class gajipegawai {
   public static void main(String[] args){
        String Rizal_Nama ;
        Integer Rizal_Divisi ;
        Integer Rizal_Jabatan ;
        Integer Rizal_Jam_Kerja ;
        Integer Rizal_Gaji_Pokok = 0 ;
        Integer Rizal_Tunjangan = 0 ;
        Integer Rizal_Lembur = 0 ;
        Integer Rizal_Hasil = 0 ;
        Integer Rizal_JML = 0 ;
        Integer Rizal_Gaji_Bersih = 0 ;
       
        Scanner in=new Scanner(System.in);
       
        System.out.println("Nama Pegawai : ");
        Rizal_Nama=in.nextLine();
        System.out.println("Pilih Divisi Pegawai : \n 1. IT \n 2. Accounting \n 3. Produksi : ");
        Rizal_Divisi=in.nextInt();
       
        switch (Rizal_Divisi){
            case 1:
                System.out.println("Pilih Jabatan Pegawai : \n 1. Kepala \n 2. Supervisor \n 3. Staff \n 4. Operator : ");
                Rizal_Jabatan=in.nextInt();
                System.out.println("jam kerja : ");
                Rizal_Jam_Kerja=in.nextInt();
                System.out.println("====================================");
                System.out.println("Nama Pegawai : "+Rizal_Nama);
                System.out.println("Divisi Pegawai : IT ");
                    switch (Rizal_Jabatan) {
                        case 1:
                            System.out.println("Jabatan Pegawai : Kepala ");
                            System.out.println("Jam Kerja : "+Rizal_Jam_Kerja);
                            Rizal_Gaji_Pokok = 12000000 ;
                            Rizal_Tunjangan = 1000000 ;
                            Rizal_Lembur = 200000 ;
                            System.out.println("================================");
                            System.out.println("Gaji Pokok : "+Rizal_Gaji_Pokok);
                            System.out.println("Tunjangan : "+Rizal_Tunjangan);
                                if (Rizal_Jam_Kerja <= 120) {
                                    Rizal_Hasil = 0 ;
                                    System.out.println("lembur : "+Rizal_Hasil);
                                } else if (Rizal_Jam_Kerja >= 120) {
                                    Rizal_Hasil = Rizal_Jam_Kerja - 120 ;
                                    Rizal_JML = Rizal_Hasil * Rizal_Lembur ;
                                    System.out.println("Lembur : "+Rizal_JML);
                                } else {
                                }
                               
                                if (Rizal_Jam_Kerja <= 120) {
                                    Rizal_Hasil = Rizal_Jam_Kerja - 120 ;
                                    Rizal_JML = Rizal_Hasil * 10000 ;
                                    System.out.println("Potongan : "+Rizal_JML);
                                } else {
                                    Rizal_Hasil = 0 ;
                                    System.out.println("Potongan : "+Rizal_Hasil);
                                }
                            break;
                        case 2:
                            System.out.println("Jabatan Pegawai : Supervisor ");
                            System.out.println("Jam kerja : "+Rizal_Jam_Kerja);
                            Rizal_Gaji_Pokok = 8000000 ;
                            Rizal_Tunjangan = 750000 ;
                            Rizal_Lembur = 150000 ;
                            System.out.println("================================");
                            System.out.println("Gaji Pokok : "+Rizal_Gaji_Pokok);
                            System.out.println("Tunjangan : "+Rizal_Tunjangan);
                                if (Rizal_Jam_Kerja <= 120) {
                                    Rizal_Hasil = 0 ;
                                    System.out.println("lembur : "+Rizal_Hasil);
                                } else if (Rizal_Jam_Kerja >= 120) {
                                    Rizal_Hasil = Rizal_Jam_Kerja - 120 ;
                                    Rizal_JML = Rizal_Hasil * Rizal_Lembur ;
                                    System.out.println("Lembur : "+Rizal_JML);
                                } else {
                                }
                               
                                if (Rizal_Jam_Kerja <= 120) {
                                    Rizal_Hasil = Rizal_Jam_Kerja - 120 ;
                                    Rizal_JML = Rizal_Hasil * 10000 ;
                                    System.out.println("Potongan : "+Rizal_JML);
                                } else {
                                    Rizal_Hasil = 0 ;
                                    System.out.println("Potongan : "+Rizal_Hasil);
                                }
                            break;
                        case 3:
                            System.out.println("Jabatan Pegawai : Staff ");
                            System.out.println("Jam kerja : "+Rizal_Jam_Kerja);
                            Rizal_Gaji_Pokok = 5000000 ;
                            Rizal_Tunjangan = 500000 ;
                            Rizal_Lembur = 100000 ;
                            System.out.println("================================");
                            System.out.println("Gaji Pokok : "+Rizal_Gaji_Pokok);
                            System.out.println("Tunjangan : "+Rizal_Tunjangan);
                                if (Rizal_Jam_Kerja <= 120) {
                                    Rizal_Hasil = 0 ;
                                    System.out.println("lembur : "+Rizal_Hasil);
                                } else if (Rizal_Jam_Kerja >= 120) {
                                    Rizal_Hasil = Rizal_Jam_Kerja - 120 ;
                                    Rizal_JML = Rizal_Hasil * Rizal_Lembur ;
                                    System.out.println("Lembur : "+Rizal_JML);
                                } else {
                                }
                               
                                if (Rizal_Jam_Kerja <= 120) {
                                    Rizal_Hasil = Rizal_Jam_Kerja - 120 ;
                                    Rizal_JML = Rizal_Hasil * 10000 ;
                                    System.out.println("Potongan : "+Rizal_JML);
                                } else {
                                    Rizal_Hasil = 0 ;
                                    System.out.println("Potongan : "+Rizal_Hasil);
                                }
                            break;
                        case 4:
                            System.out.println("Jabatan Pegawai : Operator ");
                            System.out.println("Jam kerja : "+Rizal_Jam_Kerja);
                            Rizal_Gaji_Pokok = 3000000 ;
                            Rizal_Tunjangan = 0 ;
                            Rizal_Lembur = 100000 ;
                            System.out.println("================================");
                            System.out.println("Gaji Pokok : "+Rizal_Gaji_Pokok);
                            System.out.println("Tunjangan : "+Rizal_Tunjangan);
                                if (Rizal_Jam_Kerja <= 120) {
                                    Rizal_Hasil = 0 ;
                                    System.out.println("lembur : "+Rizal_Hasil);
                                } else if (Rizal_Jam_Kerja >= 120) {
                                    Rizal_Hasil = Rizal_Jam_Kerja - 120 ;
                                    Rizal_JML = Rizal_Hasil * Rizal_Lembur ;
                                    System.out.println("Lembur : "+Rizal_JML);
                                } else {
                                }
                               
                                if (Rizal_Jam_Kerja <= 120) {
                                    Rizal_Hasil = Rizal_Jam_Kerja - 120 ;
                                    Rizal_JML = Rizal_Hasil * 10000 ;
                                    System.out.println("Potongan : "+Rizal_JML);
                                } else {
                                    Rizal_Hasil = 0 ;
                                    System.out.println("Potongan : "+Rizal_Hasil);
                                }
                            break;
                    }
                break;
            case 2:
                System.out.println("Jabatan Pegawai : \n 1. Kepala \n 2. Supervisor \n 3. Staff \n 4. Operator : ");
                Rizal_Jabatan=in.nextInt();
                System.out.println("jam kerja : ");
                Rizal_Jam_Kerja=in.nextInt();
                System.out.println("Nama Pegawai : "+Rizal_Nama);
                System.out.println("Divisi Pegawai : Accounting ");
                    switch (Rizal_Jabatan) {
                        case 1:
                            System.out.println("Jabatan Pegawai : Kepala ");
                            System.out.println("Jam Kerja : "+Rizal_Jam_Kerja);
                            Rizal_Gaji_Pokok = 10000000 ;
                            Rizal_Tunjangan = 1000000 ;
                            Rizal_Lembur = 200000 ;
                            System.out.println("================================");
                            System.out.println("Gaji Pokok : "+Rizal_Gaji_Pokok);
                            System.out.println("Tunjangan : "+Rizal_Tunjangan);
                                if (Rizal_Jam_Kerja <= 120) {
                                    Rizal_Hasil = 0 ;
                                    System.out.println("lembur : "+Rizal_Hasil);
                                } else if (Rizal_Jam_Kerja >= 120) {
                                    Rizal_Hasil = Rizal_Jam_Kerja - 120 ;
                                    Rizal_JML = Rizal_Hasil * Rizal_Lembur ;
                                    System.out.println("Lembur : "+Rizal_JML);
                                } else {
                                }
                               
                                if (Rizal_Jam_Kerja <= 120) {
                                    Rizal_Hasil = Rizal_Jam_Kerja - 120 ;
                                    Rizal_JML = Rizal_Hasil * 10000 ;
                                    System.out.println("Potongan : "+Rizal_JML);
                                } else {
                                    Rizal_Hasil = 0 ;
                                    System.out.println("Potongan : "+Rizal_Hasil);
                                }
                            break;
                        case 2:
                            System.out.println("Jabatan Pegawai : Supervisor ");
                            System.out.println("Jam Kerja : "+Rizal_Jam_Kerja);
                            Rizal_Gaji_Pokok = 7000000 ;
                            Rizal_Tunjangan = 750000 ;
                            Rizal_Lembur = 150000 ;
                            System.out.println("================================");
                            System.out.println("Gaji Pokok : "+Rizal_Gaji_Pokok);
                            System.out.println("Tunjangan : "+Rizal_Tunjangan);
                                if (Rizal_Jam_Kerja <= 120) {
                                    Rizal_Hasil = 0 ;
                                    System.out.println("lembur : "+Rizal_Hasil);
                                } else if (Rizal_Jam_Kerja >= 120) {
                                    Rizal_Hasil = Rizal_Jam_Kerja - 120 ;
                                    Rizal_JML = Rizal_Hasil * Rizal_Lembur ;
                                    System.out.println("Lembur : "+Rizal_JML);
                                } else {
                                }
                               
                                if (Rizal_Jam_Kerja <= 120) {
                                    Rizal_Hasil = Rizal_Jam_Kerja - 120 ;
                                    Rizal_JML = Rizal_Hasil * 10000 ;
                                    System.out.println("Potongan : "+Rizal_JML);
                                } else {
                                    Rizal_Hasil = 0 ;
                                    System.out.println("Potongan : "+Rizal_Hasil);
                                }
                            break;
                        case 3:
                            System.out.println("Jabatan Pegawai : Staff ");
                            System.out.println("Jam kerja : "+Rizal_Jam_Kerja);
                            Rizal_Gaji_Pokok = 4500000 ;
                            Rizal_Tunjangan = 500000 ;
                            Rizal_Lembur = 100000 ;
                            System.out.println("================================");
                            System.out.println("Gaji Pokok : "+Rizal_Gaji_Pokok);
                            System.out.println("Tunjangan : "+Rizal_Tunjangan);
                                if (Rizal_Jam_Kerja <= 120) {
                                    Rizal_Hasil = 0 ;
                                    System.out.println("lembur : "+Rizal_Hasil);
                                } else if (Rizal_Jam_Kerja >= 120) {
                                    Rizal_Hasil = Rizal_Jam_Kerja - 120 ;
                                    Rizal_JML = Rizal_Hasil * Rizal_Lembur ;
                                    System.out.println("Lembur : "+Rizal_JML);
                                } else {
                                }
                               
                                if (Rizal_Jam_Kerja <= 120) {
                                    Rizal_Hasil = Rizal_Jam_Kerja - 120 ;
                                    Rizal_JML = Rizal_Hasil * 10000 ;
                                    System.out.println("Potongan : "+Rizal_JML);
                                } else {
                                    Rizal_Hasil = 0 ;
                                    System.out.println("Potongan : "+Rizal_Hasil);
                                }
                            break;
                        case 4:
                            System.out.println("Jabatan Pegawai : Operator ");
                            System.out.println("Jam kerja : "+Rizal_Jam_Kerja);
                            Rizal_Gaji_Pokok = 3000000 ;
                            Rizal_Tunjangan = 0 ;
                            Rizal_Lembur = 100000 ;
                            System.out.println("================================");
                            System.out.println("Gaji Pokok : "+Rizal_Gaji_Pokok);
                            System.out.println("Tunjangan : "+Rizal_Tunjangan);
                                if (Rizal_Jam_Kerja <= 120) {
                                    Rizal_Hasil = 0 ;
                                    System.out.println("lembur : "+Rizal_Hasil);
                                } else if (Rizal_Jam_Kerja >= 120) {
                                    Rizal_Hasil = Rizal_Jam_Kerja - 120 ;
                                    Rizal_JML = Rizal_Hasil * Rizal_Lembur ;
                                    System.out.println("Lembur : "+Rizal_JML);
                                } else {
                                }
                               
                                if (Rizal_Jam_Kerja <= 120) {
                                    Rizal_Hasil = Rizal_Jam_Kerja - 120 ;
                                    Rizal_JML = Rizal_Hasil * 10000 ;
                                    System.out.println("Potongan : "+Rizal_JML);
                                } else {
                                    Rizal_Hasil = 0 ;
                                    System.out.println("Potongan : "+Rizal_Hasil);
                                }
                            break;
                    }
                break;
            case 3:
                System.out.println("Jabatan Pegawai : \n 1. Kepala \n 2. Supervisor \n 3. Operator : ");
                Rizal_Jabatan=in.nextInt();
                System.out.println("jam kerja : ");
                Rizal_Jam_Kerja=in.nextInt();
                System.out.println("Nama Pegawai : "+Rizal_Nama);
                System.out.println("Divisi Pegawai : Produksi ");
                    switch (Rizal_Jabatan) {
                        case 1:
                            System.out.println("Jabatan Pegawai : Kepala ");
                            System.out.println("Jam kerja : "+Rizal_Jam_Kerja);
                            Rizal_Gaji_Pokok = 8000000 ;
                            Rizal_Tunjangan = 1000000 ;
                            Rizal_Lembur = 200000 ;
                            System.out.println("================================");
                            System.out.println("Gaji Pokok : "+Rizal_Gaji_Pokok);
                            System.out.println("Tunjangan : "+Rizal_Tunjangan);
                                if (Rizal_Jam_Kerja <= 120) {
                                    Rizal_Hasil = 0 ;
                                    System.out.println("lembur : "+Rizal_Hasil);
                                } else if (Rizal_Jam_Kerja >= 120) {
                                    Rizal_Hasil = Rizal_Jam_Kerja - 120 ;
                                    Rizal_JML = Rizal_Hasil * Rizal_Lembur ;
                                    System.out.println("Lembur : "+Rizal_JML);
                                } else {
                                }
                               
                                if (Rizal_Jam_Kerja <= 120) {
                                    Rizal_Hasil = Rizal_Jam_Kerja - 120 ;
                                    Rizal_JML = Rizal_Hasil * 10000 ;
                                    System.out.println("Potongan : "+Rizal_JML);
                                } else {
                                    Rizal_Hasil = 0 ;
                                    System.out.println("Potongan : "+Rizal_Hasil);
                                }
                            break;
                        case 2:
                            System.out.println("Jabatan Pegawai : Supervisor ");
                            System.out.println("Jam kerja : "+Rizal_Jam_Kerja);
                            Rizal_Gaji_Pokok = 5000000 ;
                            Rizal_Tunjangan = 750000 ;
                            Rizal_Lembur = 150000 ;
                            System.out.println("================================");
                            System.out.println("Gaji Pokok : "+Rizal_Gaji_Pokok);
                            System.out.println("Tunjangan : "+Rizal_Tunjangan);
                                if (Rizal_Jam_Kerja <= 120) {
                                    Rizal_Hasil = 0 ;
                                    System.out.println("lembur : "+Rizal_Hasil);
                                } else if (Rizal_Jam_Kerja >= 120) {
                                    Rizal_Hasil = Rizal_Jam_Kerja - 120 ;
                                    Rizal_JML = Rizal_Hasil * Rizal_Lembur ;
                                    System.out.println("Lembur : "+Rizal_JML);
                                } else {
                                }
                               
                                if (Rizal_Jam_Kerja <= 120) {
                                    Rizal_Hasil = Rizal_Jam_Kerja - 120 ;
                                    Rizal_JML = Rizal_Hasil * 10000 ;
                                    System.out.println("Potongan : "+Rizal_JML);
                                } else {
                                    Rizal_Hasil = 0 ;
                                    System.out.println("Potongan : "+Rizal_Hasil);
                                }
                            break;
                        case 3:
                            System.out.println("Jabatan anda : Operator ");
                            System.out.println("Jam kerja anda : "+Rizal_Jam_Kerja);
                            Rizal_Gaji_Pokok = 3000000 ;
                            Rizal_Tunjangan = 0 ;
                            Rizal_Lembur = 100000 ;
                            System.out.println("================================");
                            System.out.println("Gaji Pokok : "+Rizal_Gaji_Pokok);
                            System.out.println("Tunjangan : "+Rizal_Tunjangan);
                                if (Rizal_Jam_Kerja <= 120) {
                                    Rizal_Hasil = 0 ;
                                    System.out.println("lembur : "+Rizal_Hasil);
                                } else if (Rizal_Jam_Kerja >= 120) {
                                    Rizal_Hasil = Rizal_Jam_Kerja - 120 ;
                                    Rizal_JML = Rizal_Hasil * Rizal_Lembur ;
                                    System.out.println("Lembur : "+Rizal_JML);
                                } else {
                                }
                               
                                if (Rizal_Jam_Kerja <= 120) {
                                    Rizal_Hasil = Rizal_Jam_Kerja - 120 ;
                                    Rizal_JML = Rizal_Hasil * 10000 ;
                                    System.out.println("Potongan : "+Rizal_JML);
                                } else {
                                    Rizal_Hasil = 0 ;
                                    System.out.println("Potongan : "+Rizal_Hasil);
                                }
                            break;
                    }
                break;
        }
        Rizal_Gaji_Bersih = Rizal_Gaji_Pokok + Rizal_Tunjangan + Rizal_JML ;
        System.out.println("Gaji Bersih Anda : "+Rizal_Gaji_Bersih);
    }
}

2 komentar

thanks kak tutorialnya,. aku suka banget sama bahasa pemrograman JAVA, jd seneng banget kalo nemu tutorial begini ehehehe,.

thanks gan sangan bermanfaat tutorialnya..


EmoticonEmoticon