Sunday, 28 February 2021

Code Program C++ Menghitung Gaji Pokok , Upah Lembur , Total Gaji Karyawan

     Output :













    Code Program :

    #include <iostream>

    #include <conio.h>

    using namespace std;

    int main(){


cout << "\n          GAJI KARYAWAN PT. ABC" ;

  cout << "\n  ========================================";

  cout << endl;

 

  string nama;

  char golongan;

  int jam_kerja, gaji_pokok, total_upah;

 

     // proses input

  cout << "\n     Nama Karyawan    : ";

  getline(cin,nama);

 

  cout << "\n     Golongan         : ";

  cin >> golongan;

 

  cout << "\n     Jumlah jam kerja : ";

  cin >> jam_kerja;

 

     // tentukan jumlah upah per jam berdasarkan golongan

  switch (golongan) {

  case '1':

        gaji_pokok = 100000;

        break;

  case '2':

        gaji_pokok = 150000;

        break;

  case '3':

        gaji_pokok = 200000;

        break;

      }

    total_upah = jam_kerja * gaji_pokok;

 

  // cek apakah jam kerja lebih dari 48 jam

  if ( (jam_kerja - 48) > 0 ) {

         total_upah = total_upah + ((jam_kerja - 48)*20000);

  }

 

  // proses output

cout << endl;

cout << "\n     Gaji Pokok   = Rp." << gaji_pokok;

         cout << endl;

         cout << "\n     Upah Lembur  = Rp." << ((jam_kerja - 48)*20000)<<"  [ Rp.20000/Jam ]";

         cout << endl;

         cout << "\n     Total  Gaji  = Rp." <<  ((jam_kerja - 48)*20000) + gaji_pokok<<" [ /Minggu ]";

  cout << "\n  ==========================================";

 

     return 0;

    }

No comments:

Post a Comment

Utamakan Sopan / Santun