Nomor 5

mail@pastecode.io avatar
unknown
c_cpp
2 years ago
1.4 kB
6
Indexable
Never
#include<iostream>
using namespace std;

int main(){
    int golongan, jamKerja, gajiTetap, gajiJam, jamLembur, gajiJam_total, gajiLembur, gajiTotal;

    cout << "Masukkan golongan : ";
    cin >> golongan;
    cout << "Masukkan jumlah jam kerja : ";
    cin >> jamKerja;

    if (golongan == 1) {
        gajiTetap = 1500000;
        gajiJam = 10000;
    } else if (golongan == 2) {
        gajiTetap = 1750000;
        gajiJam = 12500;
    } else if (golongan == 3) {
        gajiTetap = 2000000;
        gajiJam = 15000;
    } else if (golongan == 4) {
        gajiTetap = 2500000;
        gajiJam = 17500;
    } else if (golongan == 5) {
        gajiTetap = 3000000;
        gajiJam = 20000;
    }

    if (jamKerja > 120) {
        jamLembur = jamKerja - 120;
    } else {
        jamLembur = 0;
    }

    gajiLembur = 1.5 * jamLembur * gajiJam;
    gajiJam_total = jamKerja * gajiJam;
    gajiTotal = gajiTetap + (jamKerja * gajiJam) + gajiLembur;

    cout << "Jam kerja        =   " << jamKerja << endl;
    cout << "Jam lembur       =   " << jamLembur << endl;
    cout << "Gaji per jam     = Rp" << gajiJam << endl;
    cout << "Gaji tetap       = Rp" << gajiTetap << endl;
    cout << "Ttl Gaji per jam = Rp" << gajiJam_total << endl;
    cout << "Gaji lembur      = Rp" << gajiLembur << endl;
    cout << "Gaji total       = Rp" << gajiTotal << endl;
}