1+ print (" Program Menghitung Gaji Mingguan Pak Wowo" )
2+
3+ total_gaji_mingguan = 0
4+ total_jam_lembur = 0
5+ total_bonus_malam = 0
6+
7+ gaji_pokok = 100000
8+ bonus_malam = 50000
9+ jumlah_hari = 7
10+
11+ for hari in range (1 , jumlah_hari + 1 ):
12+ print (f"\n Hari ke-{ hari } " )
13+
14+ gaji_harian = gaji_pokok
15+ bonus_lembur_harian = 0
16+ bonus_malam_harian = 0
17+
18+ while True :
19+ shift_malam = input (f"Apakah hari ke-{ hari } shift malam (iya/tidak): " )
20+ pass
21+
22+ if shift_malam == "iya" or shift_malam == "tidak" :
23+ break
24+ else :
25+ print ("Error : Input harus 'iya' atau 'tidak'. Coba lagi yaa" )
26+
27+ while True :
28+ jam_lembur = input (f"Masukkan jam lembur hari ke-{ hari } : " )
29+
30+ input_angka_valid = True
31+
32+ if jam_lembur == "" :
33+ input_angka_valid = False
34+ elif jam_lembur == 0 :
35+ input_angka_valid == False
36+ else :
37+ for karakter in jam_lembur :
38+ if karakter not in "0123456789" :
39+ input_angka_valid = False
40+ break
41+ if input_angka_valid :
42+ jam_lembur = int (jam_lembur )
43+ break
44+ else :
45+ print ("Error : Input harus berupa angka bulat positif ( 1, 2, 3 ...). Coba inputkan lagi." )
46+
47+ if jam_lembur > 8 :
48+ print ("Peringatan : Lembur melebihi batas (8 jam), bonus lembur tidak dihitung." )
49+ bonus_lembur_harian = 0
50+ elif jam_lembur == 8 :
51+ bonus_lembur_harian = 300000
52+ elif jam_lembur == 6 :
53+ bonus_lembur_harian = 200000
54+ elif jam_lembur == 4 :
55+ bonus_lembur_harian = 100000
56+ elif 1 <= jam_lembur <= 3 :
57+ bonus_lembur_harian = jam_lembur * 25000
58+
59+ if shift_malam == "iya" :
60+ bonus_malam_harian = bonus_malam
61+
62+ total_jam_lembur += jam_lembur
63+ total_bonus_malam += bonus_malam_harian
64+ gaji_harian = gaji_pokok + bonus_lembur_harian + bonus_malam_harian
65+ total_gaji_mingguan += gaji_harian
66+ print ("\n ========================================== " )
67+ print (" Rekapitulasi " )
68+ print ("\n ========================================== " )
69+ print (f"Total Jam lembur pak wowo seminggu: { total_jam_lembur } jam" )
70+ print (f"Total Bonus pak wowo shift malam: Rp{ total_bonus_malam } " )
71+ print (f"Total Gaji mingguan pak wowo: Rp{ total_gaji_mingguan } " )
72+ print ("x" * 35 )
0 commit comments