Minggu, 25 November 2012

-BSI- Latihan 8.4.2

Langsung aja gan program fix'a... :D

Tampilan outputan



#include <iostream.h>
#include <iomanip.h>
#include <stdio.h>
#include <conio.h>

garis()
{puts("---------------------------------------------------------------------------");}

main()
{
long int i, x, jk[10], tj[10], hl[10], pj[10], pb[10], tg=0;
char nm[10][20], gl[10], a[10][10];

clrscr();
cout<<"Program Hitung Honor Karyawan Kontrak PT. STAY COOL"<<endl;
cout<<endl;
cout<<"Masukkan Jumlah Karyawan = ";cin>>x;
cout<<endl;
for(i=1;i<=x;i++)
{
cout<<"Karyawan ke- "<<i<<endl;
cout<<"Nama Karyawan    : ";gets(nm[i]);
cout<<"Golongan [1/2/3] : ";cin>>gl[i];
cout<<"Jumlah Jam Kerja : ";cin>>jk[i];
cout<<endl;
{
if (gl[i]=='1')
 tj[i]=700000*5/100;
else if (gl[i]=='2')
 tj[i]=700000*10/100;
else if (gl[i]=='3')
 tj[i]=700000*15/100;
else
 tj[i]=0;
 }
{
if (jk[i]>=240)
 hl[i]=((jk[i]-240)*2500);
else
 hl[i]=0;
 }
{pj[i]=((700000+tj[i]+hl[i])*10/100);}

{pb[i]=((700000+tj[i]+hl[i])-pj[i]);}

tg=tg+pb[i];
}

garis();
cout<<"|                              PT.STAY COOL                               |"<<endl;
garis();
cout<<"|No.| Nama               | Tunjangan | Honor     | Pajak     | Pendapatan |"<<endl;
cout<<"|   | Karyawan           | Jabatan   | Lembur    |           | Bersih     |"<<endl;
garis();
for(i=1;i<=x;i++)
{
cout<<setiosflags(ios::left)<<"| "<<setw(2)<<i;
cout<<setiosflags(ios::left)<<"| "<<setw(19)<<nm[i];
cout<<setiosflags(ios::right)<<"| "<<setw(10)<<tj[i];
cout<<setiosflags(ios::right)<<"| "<<setw(10)<<hl[i];
cout<<setiosflags(ios::right)<<"| "<<setw(10)<<pj[i];
cout<<setiosflags(ios::left)<<"| Rp  "<<setw(7)<<pb[i]<<"|";
cout<<endl;
}
garis();
cout<<"                                  Total Gaji yang dikeluarkan  Rp "<<tg<<endl;

getch();
}

Tidak ada komentar:

Posting Komentar