Membuat Program Gaji pada NetBeans

5:18 AM Unknown 0 Comments

Membuat Program Gaji pada NetBeans

Note : Buat New Project dengan nama "ProgramGaji".

package program.gaji;

import java.util.Scanner;

public class ProgramGaji
{
    public static void main(String[]args)
    {
   
    String nama,jabatan = null;
    int pekerjaan = 0,TunjanganIstri,TunjanganAnak = 0;
    double totalgaji,gajipokok,jml,lembur,bonusTI = 0,bonusTA = 0;
            Scanner s = new Scanner(System.in);
                          System.out.println("      Program Gaji    ");
                          System.out.println(" I Made Danan Widagdo ");
                          System.out.println("       140010341      ");
            System.out.println("              Program Gaji Karyawan              ");
            System.out.println("=================================================");
            System.out.println("                  Masukkan Nama                :");
            nama = s.nextLine();
            System.out.println("Masukkan Jabatan  Manager[1] Kabid[2] Staff[3] = ");
            pekerjaan=s.nextInt();
            System.out.println("               Masukkan Jumlah Istri           = ");
            TunjanganIstri=s.nextInt();
            System.out.println("               Masukkan Jumlah Anak            = ");
                TunjanganAnak=s.nextInt();
          
         
                    switch (pekerjaan)
                    {
                        case 1:
                                jabatan="Manager";
                                gajipokok=4000000;
                               
                                    if(TunjanganIstri>4)
                                        bonusTI=1500000;
                                    else if(TunjanganIstri>=2)
                                        bonusTI=800000;
                                    else if(TunjanganIstri==1)
                                        bonusTI=500000;
                                    else
                                        bonusTI=0;   
                                   
                                    if(TunjanganAnak>4)
                                        bonusTA=3000000;
                                    else if(TunjanganAnak>=2)
                                        bonusTA=2000000;
                                    else if(TunjanganAnak==1)
                                        bonusTA=800000;
                                    else
                                        bonusTA=0;   
                                break;
                           
                        case 2:
                                jabatan="Kabid";
                                gajipokok=3000000;
                               
                                    if(TunjanganIstri>4)
                                        bonusTI=1000000;
                                    else if(TunjanganIstri>=2)
                                        bonusTI=600000;
                                    else if(TunjanganIstri==1)
                                        bonusTI=400000;
                                    else
                                        bonusTI=0; 
                                   
                                    if(TunjanganAnak>4)
                                        bonusTA=1500000;
                                    else if(TunjanganAnak>=2)
                                        bonusTA=800000;
                                    else if(TunjanganAnak==1)
                                        bonusTA=500000;
                                    else
                                        bonusTA=0;  
                                break;
                          
                        case 3:       
                                jabatan="Staff";
                                gajipokok=1500000;
                               
                                    if(TunjanganIstri>=1)
                                        bonusTI=200000;
                                    else
                                        bonusTI=0;
                                   
                                   
                                    if(TunjanganAnak>=1)
                                        bonusTA=500000;
                                    else
                                        bonusTA=0;
                                break;
                           
                        default:
                                jabatan="Salah Input";
                                gajipokok=0;
                    }

                   totalgaji=gajipokok+bonusTI+bonusTA;
System.out.println("=================================================");                                   
System.out.println("Nama            = "+nama);
System.out.println("Jabatan         = "+jabatan);
System.out.println("================================================="); 
System.out.println("Gaji Pokok      = "+gajipokok);
System.out.println("Tunjangan Istri = "+bonusTI);
System.out.println("Tunjangan Anak  = "+bonusTA);
System.out.println("================================================= + ");
System.out.println("Total Gaji      = "+totalgaji);

   }
}

0 comments: