Percabangan

Percabangan
Disini saya akan membahas konsep program percabangan,PT dibawah ini,mari simak gan:

Screenshot_1





Screenshot_2

 INPUT NYA :

#include <iostream>

using namespace std;

int main()
{
  string nama;
    float honor=300000, tunjangan_j, gol, tunjangan_p, p, h_lembur=2500, kalikan_lembur, jam_k, honor_akhir;

/* INPUT */
      cout<<" PROGRAM HITUNG HONOR KARYAWAN "<<endl;
      cout<<" PT. DINGIN DAMAI "<<endl;
      cout<<"___________________________________________________"<<endl;
      cout<<"NAMA KARYAWAN : ";cin>>nama;
      cout<<"GOLONGAN JABATAN 1/2/3 : ";cin>>gol;
      cout<<"PENDIDIKAN 1.SMU/2.D3/3.S1 : ";cin>>p;
      cout<<"TOTAL JAM KERJA : ";cin>>jam_k;
      cout<<"___________________________________________________"<<endl;

/* TUNJANGAN JABATAN */
       if (gol == 1) {
                      tunjangan_j=honor*0.05;
                     }
       else if (gol == 2){
                           tunjangan_j=honor*0.1;
                         }
       else if (gol < 4){
                          tunjangan_j=honor*0.15;
                        }

/* TUNJANGAN PENDIDIKAN */
              if (p==1){
                         tunjangan_p = honor*0.025;
                       }
              else if (p == 2){
                                tunjangan_p = honor*0.05;
                              }
              else if (p < 4){
                               tunjangan_p = honor*0.075;
                             }

/* HONOR LEMBUR */
             if (jam_k <8){
                           kalikan_lembur = 0;
                          }
             else if (jam_k ==8){
                                  kalikan_lembur = h_lembur;
                                }
             else if (jam_k == 9){
                                   kalikan_lembur = h_lembur+2500;
                                  }
             else if (jam_k == 10){
                                   kalikan_lembur = h_lembur+5000;
                                  }
             else if (jam_k == 11){
                                   kalikan_lembur = h_lembur+7500;
                                  }
             else if (jam_k == 12){
                                   kalikan_lembur = h_lembur+10000;
                                  }
                                  cout<<endl;
/* HONOR AKHIR */
honor_akhir= tunjangan_j+tunjangan_p+kalikan_lembur+honor;

/* OUTPUT */
 cout<<"=============================================";
 cout<<endl;
 cout<<"Karyawan Yang Bernama : "<<nama;
 cout<<endl;
 cout<<endl;

 cout<<"Honor Yang Diterima: "<<endl;
 cout<<"Honor Tetap : "<<honor<<endl;
 cout<<"Tunjangan Jabatan : "<<tunjangan_j<<endl;
 cout<<"Tunjangan Pendidikan : "<<tunjangan_p<<endl;
 cout<<"Honor Lembur : "<<kalikan_lembur<<endl;
 cout<<"============================================="<<endl;
 cout<<"Honor Akhir : "<<honor_akhir<<endl;

  return 0;
}















OUTPUTNYA :


THANKS YOU

 

0 Response

Posting Komentar

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel