Advertisement
Aankalvin

Contoh While

Nov 18th, 2017
444
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.94 KB | None | 0 0
  1.  */
  2. package Praktikum;
  3. import java.io.*;
  4. /**
  5.  *
  6.  * @author 305
  7.  */
  8. public class Latihan6 {
  9.  
  10.     /**
  11.      * @param args the command line arguments
  12.      */
  13.    
  14.    
  15.     public static void main(String[] args) {
  16.         String nip,nama,gol;
  17.         int i=0;
  18.          int a,b,c,lama_ker,gapok,tunj,upah_lembur,jam_kerja;
  19.          double pph,gajikes;
  20.         DataInputStream input =new DataInputStream(System.in);
  21.         while(i < 20){
  22.         try{
  23.         System.out.print("Masukkan NIP :");
  24.         nip =input.readLine();
  25.          System.out.print("Masukkan Nama :");
  26.         nama =input.readLine();
  27.         System.out.print("Masukkan Golongan :");
  28.         gol =input.readLine();
  29.         System.out.print("Masukkan LAMA KERJA :");
  30.         lama_ker =Integer.parseInt(input.readLine());
  31.        
  32.         switch(gol)
  33.         {
  34.             case "3A" :
  35.             { gapok =1000000;
  36.                         tunj=100000;
  37.                         break;}
  38.             case "3B" :
  39.             {  gapok =2000000;
  40.                         tunj=200000; break;}
  41.             case "3C" :
  42.             {gapok=2500000;
  43.                         tunj=250000; break;}
  44.             case "3D" :
  45.             {gapok=3000000;
  46.                         tunj=300000; break;}
  47.             case "4A" :
  48.             {  gapok=3500000;
  49.                         tunj=350000;
  50.                         break;}
  51.             case "4B" :
  52.             { gapok=4000000;
  53.                         tunj=400000;break;}
  54.             case "4C" :
  55.             { gapok=4500000;
  56.                         tunj=450000;break;}
  57.             default :{ gapok=0;
  58.                         tunj=0; break;}
  59.                            
  60.         }
  61.         jam_kerja=lama_ker-7;
  62.         switch(lama_ker)
  63.         {
  64.             case 1: {
  65.                 upah_lembur=0; break;}
  66.             case 2: {
  67.                 upah_lembur=0; break;}
  68.             case 3: {
  69.                 upah_lembur=0; break;}
  70.              case 4: {
  71.                 upah_lembur=0; break;}
  72.              case 5: {
  73.                 upah_lembur=0; break;}
  74.              case 6: {
  75.                 upah_lembur=0; break;}
  76.              case 7: {
  77.                 upah_lembur=0; break;}
  78.             default : {upah_lembur=jam_kerja*50000;break;
  79.             }
  80.         }
  81.         pph=0.1 *gapok;
  82.        
  83.         gajikes=(gapok+tunj+upah_lembur)-(int)pph;
  84.         System.out.println("\n");
  85.         System.out.println("DAFTAR GAJI KARYAWAN");
  86.         System.out.println("NIP :"+nip);
  87.         System.out.println("NAMA :"+nama);
  88.         System.out.println("GOLONGAN :"+gol);
  89.         System.out.println("GAJI POKOK :"+gapok);
  90.         System.out.println("TUNAJNGAN :"+tunj);
  91.         System.out.println("UPAH LEMBUR :" +upah_lembur);
  92.         System.out.println("PPH :"+pph);
  93.         System.out.println("TOTAL GAJI :"+gajikes);
  94.         }catch(IOException e){}
  95.        
  96.             // TODO code application logic here
  97.        
  98.     }
  99.     }
  100.    
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement