Menghitung Gaji Karyawan dengan C++
#include <string>
#include <iostream>
using namespace std;
main()
{
int hari_kerja, gapok, gator, gaber, tunj, nik, trans;
string nama, jabatan;
cout<<"\n *******************"<<endl;
cout<<" * GAJI KARYAWAN *";
cout<<"\n *******************"<<endl<<endl;
cout<<"NIK : ";
cin>>nik;
cout<<"Nama Pegawai : ";
cin>>nama;
cout<<"Jabatan\n";
cout<<"(manager/supervisor/\nleader/operator) : ";
cin>>jabatan;
cout<<"Hari kerja : ";
cin>>hari_kerja;
cout<<"____________________"<<endl<<endl;
if (jabatan == "manager")
{
gapok= 5000000;
tunj=1200000;
trans=hari_kerja*40000;
gator=gapok+tunj+trans;
gaber = gator*9/10; //ini gajinya kan dipotong 10% jadi dikaliin 90%
cout<<"Jabatan : "<<jabatan<<endl;
cout<<"Gapok : Rp. "<<gapok<<endl;
cout<<"Tunjangan : Rp. "<<tunj<<endl;
cout<<"Transport : Rp. "<<trans<<endl;
cout<<"Gator : Rp. "<<gator<<endl;
cout<<"Gaber : Rp. "<<gaber<<endl;
}
else if(jabatan == "supervisor" )
{
gapok= 3000000;
tunj=600000;
trans=hari_kerja*40000;
gator=gapok+tunj+trans;
gaber = gator*9/10;
cout<<"Jabatan : "<<jabatan<<endl;
cout<<"Gapok : Rp. "<<gapok<<endl;
cout<<"Tunjangan : Rp. "<<tunj<<endl;
cout<<"Transport : Rp. "<<trans<<endl;
cout<<"Gator : Rp. "<<gator<<endl;
cout<<"Gaber : Rp. "<<gaber<<endl;
}
else if(jabatan == "leader")
{
gapok= 2400000;
tunj=350000;
trans=hari_kerja*40000;
gator=gapok+tunj+trans;
gaber = gator*9/10;
cout<<"Jabatan : "<<jabatan<<endl;
cout<<"Gapok : Rp. "<<gapok<<endl;
cout<<"Tunjangan : Rp. "<<tunj<<endl;
cout<<"Transport : Rp. "<<trans<<endl;
cout<<"Gator : Rp. "<<gator<<endl;
cout<<"Gaber : Rp. "<<gaber<<endl;
}
else if(jabatan == "operator")
{
gapok= 1500000;
tunj=850000;
trans=hari_kerja*40000;
gator=gapok+tunj+trans;
gaber = gator*9/10;
cout<<"Jabatan : "<<jabatan<<endl;
cout<<"Gapok : Rp. "<<gapok<<endl;
cout<<"Tunjangan : Rp. "<<tunj<<endl;
cout<<"Transport : Rp. "<<trans<<endl;
cout<<"Gator : Rp. "<<gator<<endl;
cout<<"Gaber : Rp. "<<gaber<<endl;
}
else
{
cout << "Isi data dengan benar !!!"<<endl;
}
system("pause"); //dua script ini buat dosnya ngga ngeclose, aktif karena fungsi #include<cstdlib>
return 0;
}
semoga bermanfaat........