Assalamualikum w.w,
PROBLEM SOLVING NO.3 HAL 414
Program mengunakan Dev C++:
#include <iostream>
#include <conio.h>
#include <stdio.h>
#include <string.h>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
char nama [50], golongan, pendidikan;
float lembur, tunjab, tunpen, gapok, gatot;
int jamker;
cout<<"\tPROGRAM HITUNG GAJI KARYAWAN";
cout<<"\n============================================"<<endl;
cout<<"keterangan : "<<endl;
cout<<" (SMA = 1, D1= 2, D3 = 3, S1= 4)"<<endl<<endl;
cout<<"\n\nNama Karyawan : ";gets(nama);
cout<<"Golongan Jabatan[1/2/3] : ";cin>>golongan;
cout<<"Pendidikan[1,2,3] : ";cin>>pendidikan;
cout<<"Jumlah jam kerja : ";cin>>jamker;
gapok = 300000;
cout<<"\nKaryawan Yang Bernama "<<nama;
switch (golongan)
{
case '1':
tunjab = gapok*0.05;
break;
case '2':
tunjab = gapok*0.1;
break;
case '3':
tunjab = gapok*0.15;
break;
default:
tunjab = 0;
}
switch (pendidikan)
{
case '1':
tunpen = gapok*0.025;
break;
case '2':
tunpen = gapok*0.05;
break;
case '3':
tunpen = gapok*0.2;
break;
case '4':
tunpen = gapok*0.3;
break;
default:
tunpen = 0;
}
if (jamker < 8 || jamker > 24)
{
lembur = 0;
}
else
lembur = (jamker - 8)*3500;
gatot = tunjab + tunpen + lembur + gapok;
cout<<"\n\nHonor Yang Diterima";
cout<<"\n\tTunjangan Jabatan Rp. "<<tunjab;
cout<<"\n\tTunjangan Pendidikan Rp. "<<tunpen;
cout<<"\n\tHonor Lembur Rp. "<<lembur;
cout<<"\n\t --------------- +";
cout<<"\n\tGaji Total Rp. "<<gatot;
return 0;
}
Gambar program nya:
Gambar output nya:
Alhamdulillah
Selamat mencoba dan semoga bermanfaat :)
Waalaikumsalam w.w.