Subscribe For Free Updates!

We'll not spam mate! We promise.

Program Slip Gaji Karyawan


import java.util.Scanner;

/**
 *
 * @author naufal
 */
public class gaji_karyawan {
    public static void main(String[] args) {
      
    Scanner in = new Scanner(System.in);
  
    String nama;
        System.out.println("Masukkan nama : ");
        nama = in.next();
  
    int jh;
        System.out.println("Masukkan jumlah Hari kerja : ");
        jh = in.nextInt();
      
    int gaji=0;
    int golongan;
        System.out.println("Masukkan Golongan : 1.A1,  2.A2");
        golongan = in.nextInt();
        switch (golongan){
            case 1 : if ( jh > 20){
                       gaji=(30000 * jh) + ( ( jh - 20 ) * 15000);
                      }else {
                        gaji = 3000 * jh;
                      };break;
            case 2: if ( jh > 20 ){
                       gaji = (50000 * jh) + ((jh - 20 ) * 15000);
                      }else {
                        gaji = 5000*jh;
                      };break;
            default :System.out.println("Maaf tidak ada dalam pilihan");           
        }
        System.out.println("Nama : "+nama);
        System.out.println("Golongan : A"+golongan);
        System.out.println("Gaji : "+gaji);
    }
}

Socializer Widget By Blogger Yard
SOCIALIZE IT →
FOLLOW US →
SHARE IT →

2 komentar:

  1. Replies
    1. iyo pak,. ada 2 kesalahan penulisan ketika ujian kemarin.., tapi yang ini uda bener 100%

      Delete