Tuesday, February 23, 2016

Listing c++ perhitungan gaji karyawan --

Aplikasi Perhitungan Gaji Karyawan

#include <iostream.h>
#include <conio.h>
#include <string.h>

char nik[5], nama[25], status[6];
int anak, gol;

void isipeg();
float gapok(int gl);
float tunjkel(char *st);
float tunjanak(int an);
float gator();
void cetakgaji();

void main(){
     isipeg();
     cetakgaji();
}

float gapok(int gl){
     float GaPok;
     if (gl==1) GaPok=1000000;
    else if (gl==2) GaPok=2000000;
       else if (gl==3) GaPok=3000000;
          else if (gl==4) GaPok=4000000;
          else  GaPok=0;
     return(GaPok);
}
float tunjkel(char *st){
     float TunjKel;
     if (strcmp(st,"Kawin")==0) TunjKel=gapok(gol)*10/100; else TunjKel=0;
     return(TunjKel);
}
float tunjanak(int an){
     float TunjAnak;
     if (an>3) TunjAnak=gapok(gol)*10/100*3; else TunjAnak=gapok(gol)*10/100*anak;
     return(TunjAnak);
}
float gator(){
     float GaTor;
     GaTor=gapok(gol)+tunjkel(status)+tunjanak(anak);
     return(GaTor);
}

void isipeg(){
     clrscr();

     cout<<"       DATA PEGAWAI  "<<endl;
     cout<<" N I K      : ";
     cin>>nik;
     cout<<" Nama       : ";
     cin>>nama;
     cout<<" Golongan   : ";
     cin>>gol;
     cout<<" Status     : ";
     cin>>status;
     cout<<" Jumlah Anak: ";
     cin>>anak;
}

void cetakgaji(){
     cout<<endl<<endl<<endl;
     cout<<"       GAJI PEGAWAI  "<<endl;
     cout<<" NIK : "<<nik <<" Nama  : "<<nama<<endl;
     cout<<" Gol : "<< gol <<" Status: "<<status<<endl;
     cout<<"                  Anak  : "<<anak<<endl;
     cout<<" ----------- GAJI -------------"<<endl;;
     cout<<"      Gaji Pokok         : Rp "<<gapok(gol)<<endl;
     cout<<"      Tunjangan Keluarga : Rp "<<tunjkel(status)<<endl;
     cout<<"      Tunjangan Anak     : Rp "<<tunjanak(anak)<<endl;
     cout<<" -------------------------------------------"<<endl;;
     cout<<"      Gaji Kotor         : Rp "<<gator()<<endl;
     cout<<endl<<endl<<endl;
     cout<<"                   Wulan Yuniati"<<endl;
     cout<<"                   -------------"<<endl;
     cout<<"                   Personalia   "<<endl;
     getch();
}

No comments:

Post a Comment