-->

Script Menghitung Gaji Karyawan Menggunakan C++

Kali ini ane mau share tentang Script Menghitung Gaji Karyawan Menggunakan C++. Selain itu ini adalah tugas kuliah. Biar  gampang ngingetnya ane post deh ke blog. Dan mudah-mudahan juga berguna bagi semua :D

Oke lansung saja lihat script berikut.!

Soal :
Sebuah perusahaan akan menghitung total gaji karyawan dengan ketentuan sbb :
 Tunjangan :
 Nikah : 75000
 Belum : 20000

 Bonus :
 gol i = 150000
 gol ii = 175000
 gol iii = 200000

 gaji pokok :
 gol i = 2000000
 gol ii = 2750000
 gol iii = 3500000

 total gaji = gaji pokok + bonus + tunjangan

Buatlah program menggunakan c++.

Jawab :

#include 
#include 

//NAMA : RIDWAN ABDULAH
//NIM  : 12131279
//STIMIK EL RAHMA

class xpenggajian
{
  public:
  char golongan[4];
  char menikah;
  char nama[30];


  long gaji_pokok()
  {
    long b;
    if ( !strcmp ( golongan, "I" ))
    {
      b = 2000000;
    }
    else if ( !strcmp ( golongan, "II" ))
    {
      b = 2750000;
    }
    else if ( !strcmp ( golongan, "III" ))
    {
      b = 3500000;
    }
    else
    {
      b = 0;
    }
    return b;
  }

  long tunjangan_anakistri()
  {
    long c;
    if ( menikah == 'B' )
    {
      c = 20000;
    }
    else if ( menikah == 'M' )
    {
      c = 75000;
    }

    else
    {
      c = 0;
    }
    return c;
  }



  long bonus()
  {
    long d;
    if ( !strcmp ( golongan, "I" ))
    {
      d = 150000;
    }
    else if ( !strcmp ( golongan, "II" ))
    {
      d = 175000;
    }
    else if ( !strcmp ( golongan, "III" ))
    {
      d = 200000;
    }
    else
    {
      d = 0;
    }
    return d;
  }

  long total_gajipokok()
  {
    long i;
    i = gaji_pokok() + tunjangan_anakistri() + bonus();
    return i;
  }


};

main()
{
  xpenggajian p;

  cout<<"\n";
  cout<<"         PROGRAM PENGGAJIAN KARYAWAN      \n";
  cout<<"                 CV.ONEMEDIA            \n";
  cout<<"   =======================================\n";
  cout<<"   NAMA                  : "; cin>>p.nama;
  cout<<"   MENIKAH (M/B)    : "; cin>>p.menikah;
  cout<<"   GOLONGAN (I/II/III)   : "; cin>>p.golongan;
  clrscr();
  cout<<"\n";
  cout<<"         PROGRAM PENGGAJIAN KARYAWAN      \n";
  cout<<"                  CV.ONEMEDIA            \n";
  cout<<"   =======================================\n";
  cout<<"   NAMA                  : " << p.nama <<"\n";
  cout<<"   MENIKAH (M/B)         : " << p.menikah <<"\n";
  cout<<"   GOLONGAN (I/II/III)   : " << p.golongan <<"\n";
  cout<<"   ---------------------------------------\n";
  cout<<"   GAJI POKOK            : Rp. " << p.gaji_pokok() <<"\n";
  cout<<"   BONUS                 : Rp. " << p.bonus() <<"\n";
  cout<<"   TUNJANGAN ANAK ISTRI  : Rp. " << p.tunjangan_anakistri() <<"\n";
  cout<<"   ---------------------------------------\n";
  cout<<"   TOTAL GAJI            : Rp. " << p.total_gajipokok() <<"\n";



  getch();
}
Share this post
  • Share to Facebook
  • Share to Twitter
  • Share to Google+
  • Share to Stumble Upon
  • Share to Evernote
  • Share to Blogger
  • Share to Email
  • Share to Yahoo Messenger
  • More...

0 komentar

:) :-) :)) =)) :( :-( :(( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ :-$ (b) (f) x-) (k) (h) (c) cheer

 
© 2011 Onemedia | 2012 Templates
Designed by BlogThietKe Cooperated with Duy Pham
Released under Creative Commons 3.0 CC BY-NC 3.0
Posts RSSComments RSS
Back to top