Mencari Total Gaji Dengan Java Programming

Dibawah ini merupakan Koding untuk mencari total gaji Karyawan dengan menggunakan java…..

Koding Program

  1. import java.io.*;
  2. public class MischanKuis {
  3. public static void main(String[] args){
  4. InputStreamReader in = new InputStreamReader(System.in);
  5. BufferedReader rd = new BufferedReader(in);
  6. String input = null;
  7. int pilihan=0;
  8. int jam_kerja=0;
  9. String nama;
  10. int upah_per_jam, lembur_per_jam,total=0;
  11. try
  12. {
  13. System.out.println(“****************************************”);
  14. System.out.println(“**********Pilihan Golongan Gaji*********”);
  15. System.out.println(“****************************************”);
  16. System.out.println(“[1].upah_per_jam=2000 & lembur_per_jam=3000 “);
  17. System.out.println(“[2].upah_per_jam=2500 & lembur_per_jam=4000 “);
  18. System.out.println(“[3].upah_per_jam=3500 & lembur_per_jam=5000 “);
  19. System.out.println(“[4].upah_per_jam=5000 & lembur_per_jam=7000 “);
  20. System.out.println(“[5].upah_per_jam=7500 & lembur_per_jam=9000 \n”);
  21. System.out.print(“Masukkan Nama Anda       : “);
  22. input = rd.readLine();
  23. System.out.print(“Masukkan Golongan [1-5]  : “);
  24. input = rd.readLine();
  25. //String temp = rd.readLine();
  26. pilihan = Integer.parseInt(input);
  27. switch (pilihan){
  28. case 1:
  29. {upah_per_jam=2000; lembur_per_jam=3000;
  30. System.out.print(“Jumlah jam kerja         : “);
  31. input = rd.readLine();
  32. jam_kerja= Integer.parseInt(input);
  33. if(jam_kerja>40)
  34. {total=(40*2000)+((jam_kerja-40)*3000);
  35. System.out.print(“Total Gaji  : “+total );}
  36. else
  37. {total=jam_kerja*2000;
  38. System.out.println(“Total Gaji               : “+total );}
  39. break;}
  40. case 2 :
  41. {upah_per_jam=2500; lembur_per_jam=4000;
  42. System.out.print(“Jumlah jam kerja         : “);
  43. input = rd.readLine();
  44. jam_kerja= Integer.parseInt(input);
  45. if(jam_kerja>40)
  46. {total=(40*2500)+((jam_kerja-40)*4000);
  47. System.out.print(“Total Gaji              : “+total );}
  48. else
  49. {total=jam_kerja*2500;
  50. System.out.println(“Total Gaji               : “+total );}
  51. break;}
  52. case 3:
  53. {upah_per_jam=3500 ; lembur_per_jam=5000;
  54. System.out.print(“Jumlah jam kerja         : “);
  55. input = rd.readLine()
  56. jam_kerja= Integer.parseInt(input);
  57. if(jam_kerja>40)
  58. {total=(40*3500)+((jam_kerja-40)*5000);
  59. System.out.print(“Total Gaji               : “+total );}
  60. else
  61. {total=jam_kerja*3500;
  62. System.out.println(“Total Gaji               : “+total );}
  63. break;}
  64. case 4 :
  65. {upah_per_jam=5000; lembur_per_jam=7000;
  66. System.out.print(“Jumlah jam kerja         : “);
  67. input = rd.readLine();
  68. jam_kerja= Integer.parseInt(input);
  69. if(jam_kerja>40)
  70. {total=(40*5000)+((jam_kerja-40)*7000);
  71. System.out.print(“Total Gaji               : “+total );}
  72. else
  73. {total=jam_kerja*5000;
  74. System.out.println(“Total Gaji               : “+total );}
  75. break;}
  76. case 5:
  77. {upah_per_jam=7500 ; lembur_per_jam=9000;
  78. System.out.print(“Jumlah jam kerja         : “);
  79. input = rd.readLine();
  80. jam_kerja= Integer.parseInt(input);
  81. if(jam_kerja>40)
  82. {total=(40*7500)+((jam_kerja-40)*9000);
  83. System.out.print(“Total Gaji               : “+total );}
  84. else
  85. {total=jam_kerja*7500;
  86. System.out.println(“Total Gaji               : “+total );}
  87. break;}
  88. }
  89. //System.out.println(“Nama Karyawan : “+nama);
  90. //System.out.println(“Golongan      : “+pilihan);
  91. //System.out.println(“Jam Kerja     : “+jam_kerja);
  92. //System.out.println(“Total Gaji    : “+total);
  93. }
  94. catch(IOException e1){}
  95. catch(NumberFormatException e2){}
  96. catch(Exception e3){}
  97. }
  98. }

HasiL Output

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: