Seorang pegawai bekerja selama 5 hari kerja, yaitu Senin sampai Jum’at. Setiap
hari dia masuk jam 08.00 dan pulang jam 16.00. Kecuali Jum’at dia pulang jam
11.00. Apabila dia bekerja lebih dari 30 jam per bulan maka setiap 5 jam akan
memperoleh uang lembur sebesar Rp 30.000,- bila kurang dari 5 jam maka akan
dihitung Rp 4.000,-/jam. Buat program dengan masukan bulan yang diinginkan,
dan outputnya berupa besarnya uang lembur pegawai tersebut
dalam C++
#include <iostream>
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) {
int bulan;
cout << " ___ UANG LEMBUR 2016 ___ " <<endl;
cout << " ======================== " <<endl<<endl;
cout << " Uang lembur yang diperoleh pada bulan ke- "; cin >> bulan;
cout << endl;
cout << " =================================================== " << endl;
switch(bulan)
{
case 1:
cout << " --- Januari --- "<<endl;
int gaji, jam1, jam2;
float total;
jam1 = 16*8;
jam2 = 5*3;
total= jam1+jam2;
cout << " Jam Kerja Selama Bulan Januari (31 Hari) adalah : "<< total <<" jam"<< endl;
if (total > 30)
{
gaji=(total/5)*30000;
cout << " Uang Lembur Yang Diperoleh Rp."<<gaji<<endl;
}
else
{
gaji=total*4000;
cout << " Uang Lembur Yang Diperoleh Rp."<<gaji<<endl;
}
break;
case 2:
cout << " --- Februari --- "<<endl;
jam1 = 17*8;
jam2 = 4*3;
total= jam1+jam2;
cout << " Jam Kerja Selama Bulan Februari (29 Hari) adalah : "<< total <<" jam"<< endl;
if (total > 30)
{
gaji=(total/5)*30000;
cout << " Uang Lembur Yang Diperoleh Rp."<<gaji<<endl;
}
else
{
gaji=total*4000;
cout << " Uang Lembur Yang Diperoleh Rp."<<gaji<<endl;
}
break;
case 3:
cout << " --- Maret --- "<<endl;
jam1 = 19*8;
jam2 = 4*3;
total= jam1+jam2;
cout << " Jam Kerja Selama Bulan Maret (31 Hari) adalah : "<< total <<" jam"<< endl;
if (total > 30)
{
gaji=(total/5)*30000;
cout << " Uang Lembur Yang Diperoleh Rp."<<gaji<<endl;
}
else
{
gaji=total*4000;
cout << " Uang Lembur Yang Diperoleh Rp."<<gaji<<endl;
}
break;
case 4:
cout << " --- April --- "<<endl;
jam1 = 16*8;
jam2 = 5*3;
total= jam1+jam2;
cout << " Jam Kerja Selama Bulan April (30 Hari) adalah : "<< total <<" jam"<< endl;
if (total > 30)
{
gaji=(total/5)*30000;
cout << " Uang Lembur Yang Diperoleh Rp."<<gaji<<endl;
}
else
{
gaji=total*4000;
cout << " Uang Lembur Yang Diperoleh Rp."<<gaji<<endl;
}
break;
case 5:
cout << " --- Mei --- "<<endl;
jam1 = 18*8;
jam2 = 4*3;
total= jam1+jam2;
cout << " Jam Kerja Selama Bulan Mei (31 Hari) adalah : "<< total <<" jam"<< endl;
if (total > 30)
{
gaji=(total/5)*30000;
cout << " Uang Lembur Yang Diperoleh Rp."<<gaji<<endl;
}
else
{
gaji=total*4000;
cout << " Uang Lembur Yang Diperoleh Rp."<<gaji<<endl;
}
break;
case 6:
cout << " --- Juni --- "<<endl;
jam1 = 18*8;
jam2 = 4*3;
total= jam1+jam2;
cout << " Jam Kerja Selama Bulan Juni (30 Hari) adalah : "<< total <<" jam"<< endl;
if (total > 30)
{
gaji=(total/5)*30000;
cout << " Uang Lembur Yang Diperoleh Rp."<<gaji<<endl;
}
else
{
gaji=total*4000;
cout << " Uang Lembur Yang Diperoleh Rp."<<gaji<<endl;
}
break;
case 7:
cout << " --- Juli --- "<<endl;
jam1 = 16*8;
jam2 = 5*3;
total= jam1+jam2;
cout << " Jam Kerja Selama Bulan Juli (31 Hari) adalah : "<< total <<" jam"<< endl;
if (total > 30)
{
gaji=(total/5)*30000;
cout << " Uang Lembur Yang Diperoleh Rp."<<gaji<<endl;
}
else
{
gaji=total*4000;
cout << " Uang Lembur Yang Diperoleh Rp."<<gaji<<endl;
}
break;
case 8:
cout << " --- Agustus --- "<<endl;
jam1 = 19*8;
jam2 = 4*3;
total= jam1+jam2;
cout << " Jam Kerja Selama Bulan Agustus (31 Hari) adalah : "<< total <<" jam"<< endl;
if (total > 30)
{
gaji=(total/5)*30000;
cout << " Uang Lembur Yang Diperoleh Rp."<<gaji<<endl;
}
else
{
gaji=total*4000;
cout << " Uang Lembur Yang Diperoleh Rp."<<gaji<<endl;
}
break;
case 9:
cout << " --- September --- "<<endl;
jam1 = 17*8;
jam2 = 5*3;
total= jam1+jam2;
cout << " Jam Kerja Selama Bulan September (30 Hari) adalah : "<< total <<" jam"<< endl;
if (total > 30)
{
gaji=(total/5)*30000;
cout << " Uang Lembur Yang Diperoleh Rp."<<gaji<<endl;
}
else
{
gaji=total*4000;
cout << " Uang Lembur Yang Diperoleh Rp."<<gaji<<endl;
}
break;
case 10:
cout << " --- Oktober --- "<<endl;
jam1 = 17*8;
jam2 = 4*3;
total= jam1+jam2;
cout << " Jam Kerja Selama Bulan Oktober (31 Hari) adalah : "<< total <<" jam"<< endl;
if (total > 30)
{
gaji=(total/5)*30000;
cout << " Uang Lembur Yang Diperoleh Rp."<<gaji<<endl;
}
else
{
gaji=total*4000;
cout << " Uang Lembur Yang Diperoleh Rp."<<gaji<<endl;
}
break;
case 11:
cout << " --- November --- "<<endl;
jam1 = 18*8;
jam2 = 4*3;
total= jam1+jam2;
cout << " Jam Kerja Selama Bulan November (30 Hari) adalah : "<< total <<" jam"<< endl;
if (total > 30)
{
gaji=(total/5)*30000;
cout << " Uang Lembur Yang Diperoleh Rp."<<gaji<<endl;
}
else
{
gaji=total*4000;
cout << " Uang Lembur Yang Diperoleh Rp."<<gaji<<endl;
}
break;
case 12:
cout << " --- Desember --- "<<endl;
jam1 = 17*8;
jam2 = 5*3;
total= jam1+jam2;
cout << " Jam Kerja Selama Bulan Agustus (31 Hari) adalah : "<< total <<" jam"<< endl;
if (total > 30)
{
gaji=(total/5)*30000;
cout << " Uang Lembur Yang Diperoleh Rp."<<gaji<<endl;
}
else
{
gaji=total*4000;
cout << " Uang Lembur Yang Diperoleh Rp."<<gaji<<endl;
}
break;
}
return 0;
}
No comments:
Post a Comment