Advertisement
Aankalvin

Contoh For

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