Sabtu, 14 Juli 2012

C++ : CONTOH PROGRAM PENGGAJIAN KARYAWAN MENGGUNAKAN ARRAY




Listing Program :

#include

struct data_karyawan
{
                char nip[6],nama[20],alamat[20],gol[2],jabatan[20],status[1];
                long int gapok,tunjabat,tunkel,jumanak,tunanak,masa,tunmasa;
                long int gator,pajak,gaber;
};

struct data_karyawan karyawan[120];

void main()
{
 int i=1;
 char ada;

 cout<<"             PROGRAM PENGGAJIAN PT.ZYX"<<"\n";
 cout<<" --------------------------------------------------"<<"\n";
                do
                {
                                cout<<" Data ke : "<
                                cout<<" Input NIP karyawan    : "; cin>>karyawan[i].nip;
                                cout<<" Input nama karyawan   : "; cin>>karyawan[i].nama;
                                cout<<" Input Alamat          : "; cin>>karyawan[i].alamat;
                                cout<<" Input golongan        : "; cin>>karyawan[i].gol;
                                                if ((karyawan[i].gol == "1c")||(karyawan[i].gol == "1C"))
                                                                {
                                                                                karyawan[i].jabatan,"Office boy/girl";
                                                                                karyawan[i].gapok = 400000;
                                                                                karyawan[i].tunjabat = 0;
                                                                }
                                                else if ((karyawan[i].gol == "2a")||(karyawan[i].gol == "2A"))
                                                                {
                                                                                karyawan[i].jabatan,"Security";
                                                                                karyawan[i].gapok = 425000;
                                                                                karyawan[i].tunjabat = 0;
                                                                }
                                                else if ((karyawan[i].gol == "2b")||(karyawan[i].gol == "2B"))
                                                                {
                                                                                karyawan[i].jabatan,"Marketing";
                                                                                karyawan[i].gapok=475000;
                                                                                karyawan[i].tunjabat = 0;
                                                                }
                                                else if ((karyawan[i].gol == "2c")||(karyawan[i].gol == "2C"))
                                                                {
                                                                                karyawan[i].jabatan,"Marketing";
                                                                                karyawan[i].gapok = 475000;
                                                                                karyawan[i].tunjabat = 0;
                                                                }
                                                else if ((karyawan[i].gol == "3a")||(karyawan[i].gol == "3A"))
                                                                {
                                                                                karyawan[i].jabatan,"Bag. gudang";
                                                                                karyawan[i].gapok = 510000;
                                                                                karyawan[i].tunjabat = 0;
                                                                }
                                                else if ((karyawan[i].gol == "3b")||(karyawan[i].gol == "3B"))
                                                                {
                                                                                karyawan[i].jabatan,"administrasi";
                                                                                karyawan[i].gapok = 550000;
                                                                                karyawan[i].tunjabat = 0.05 * karyawan[i].gapok;
                                                                }
                                                else if ((karyawan[i].gol == "3c")||(karyawan[i].gol == "3C"))
                                                                {
                                                                                karyawan[i].jabatan,"Supervisor";
                                                                                karyawan[i].gapok = 650000;
                                                                                karyawan[i].tunjabat = 0.075 * karyawan[i].gapok;
                                                                }
                                                else if ((karyawan[i].gol == "4a")||(karyawan[i].gol == "4A"))
                                                                {
                                                                                karyawan[i].jabatan,"Manajer";
                                                                                karyawan[i].gapok = 900000;
                                                                                karyawan[i].tunjabat = 0.1 * karyawan[i].gapok;
                                                                }
                                                else if ((karyawan[i].gol == "4b")||(karyawan[i].gol == "4B"))
                                                                {
                                                                                karyawan[i].jabatan,"Wakil direktur";
                                                                                karyawan[i].gapok = 1300000;
                                                                                karyawan[i].tunjabat = 0.15 * karyawan[i].gapok;
                                                                }
                                                else if ((karyawan[i].gol == "4c")||(karyawan[i].gol == "4C"))
                                                                {
                                                                                karyawan[i].jabatan,"Direktur";
                                                                                karyawan[i].gapok = 1500000;
                                                                                karyawan[i].tunjabat = 0.175 * karyawan[i].gapok;
                                                                }

                                cout<<" Input status          : "; cin>>karyawan[i].status;
                                                if (karyawan[i].status == "k")
                                                  {
                                                                karyawan[i].tunkel = 0.1 * karyawan[i].gapok;
                                                                cout<< " Input jumlah anak    : "; cin>>karyawan[i].jumanak;
                                                                                if (karyawan[i].jumanak < 2)
                                                                                                karyawan[i].tunanak = 0.05 * karyawan[i].gapok * karyawan[i].jumanak;
                                                                                else
                                                                                                karyawan[i].tunanak = 0.05 * karyawan[i].gapok * 3;
                                                  }
                                                else
                                                  {
                                                                                karyawan[i].tunkel = 0;
                                                                                karyawan[i].tunanak = 0;
                                                  }

                                cout<<" Input Masa kerja      : "; cin>>karyawan[i].masa;
                                                if (karyawan[i].masa >= 5)
                                                                karyawan[i].tunmasa = 6.5 * karyawan[i].gapok;
                                                else if (karyawan[i].masa > 10)
                                                                karyawan[i].tunmasa = 11.25 * karyawan[i].gapok;
                                                else
                                                                karyawan[i].tunmasa = 0;

                                karyawan[i].gator = karyawan[i].gapok + karyawan[i].tunkel + karyawan[i].tunanak + karyawan[i].tunjabat;
                                                if (karyawan[i].gator > 1000000)
                                                                {
                                                                                karyawan[i].pajak = 0.1 * karyawan[i].gator;
                                                                                karyawan[i].gaber = karyawan[i].gator - karyawan[i].pajak;
                                                                }
                                                else
                                                                {
                                                                                karyawan[i].pajak = 0;
                                                                                karyawan[i].gaber = karyawan[i].gator;
                                                                };

                                 cout<<" Jabatan karyawan        : "<
                                 cout<<" Gaji pokok                      :Rp. "<
                                 cout<<" Tunjangan jabatan        :Rp. "<
                                 cout<<" Tunjangan Keluarga      :Rp. "<
                                 cout<<" Tunjangan Anak             :Rp. "<
                                 cout<<" Tunjangan Masa kerja  :Rp. "<
                                 cout<<" Besar gaji kotor              :Rp. "<
                                 cout<<" Besar pajak                     :Rp. "<
                                 cout<<" Besar gaji bersih            :Rp. "<
                                 cout<
                                 i++;
                                 cout<<" Masih ada data karyawan lagi[y/t]"; cin>>ada;
                                 cout<
                 } while (ada == 'y');

 clrscr();
 int j=1;
 cout<<" Data yang telah diinput:"<<"\n";
 cout<
 cout<<"              PROGRAM PENGGAJIAN PT.ZYX"<<"\n";
 cout<<" --------------------------------------------------"<<"\n";
 do
 {
                                cout<<"  NIP                        : "<
                                cout<<"  Nama                   : "<
                                cout<<"  Alamat                 : "<
                                cout<<"  Jabatan                : "<
                                cout<<"  Gaji pokok           :Rp. "<
                                cout<<"  Tun. jabatan       :Rp. "<
                                cout<<"  Tun. Masa kerja :Rp. "<
                                cout<<"  Tun. Keluarga     :Rp. "<
                                cout<<"  Tun. anak            :Rp. "<
                                cout<
                                j++;
 } while (j
 return();
}

Jangan lupa tinggalin saran dan kritik yang bermanfaat untuk ini blog. Untuk teman-teman yang hendak mencopy artikel ini untuk dipasang pada blog atau web-nya, dengan sangat diharapkan untuk mencantumkan Link keblog ini (http://dp082010.blogspot.com) sebagai sumber artikel sekaligus sebagai backlink untuk blog ini. Terima kasih untuk pengertian dan kerjasamanya, mari berkembang bersama

3 komentar:

Unknown mengatakan...

sy sdh mencoba program ini,
tp koq ngk bisa ea..

Unknown mengatakan...

program nya banyak yang eror sampe 50 gan

gatewan.com mengatakan...

Pranala --> C++ APLIKASI PENGGAJIAN DENGAN FUNGSI NILAI BALIK DAN ARRAY