Advertisement
Aankalvin

Contoh Do while

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