#include<iostream>
#include<conio.h>
using namespace std;
int main ()
{
struct data
{
char nama[20];
char ID[20];
int gaji_60=500;
int jam_kerja;
float gaji_harian;
};struct data pegawai[20];
cout<<"------------------------------------------------\n";
cout<<"Program Structur Menghitung Gaji Harian Karyawan\n";
cout<<"------------------------------------------------\n";
int x,y;
cout<<"Masukan Data Pegawai : ";
cin>>y;
for(x=0;x<y;x++)
{
cout<<"Masukan Nama Pegawai : ";
cin>>pegawai[x].nama;
cout<<"Masukan ID Pegawai : ";
cin>>pegawai[x].ID;
cout<<"Masukan Jam Kerja Pegawai : ";
cin>>pegawai[x].jam_kerja;
cout<<endl;
}
cout<<endl;
cout<<"-----------------------------------------\n";
cout<<"Nama"<<"\t"<<"ID"<<"\t"<<"Jam Kerja"<<"\t"<<"Gaji Harian"<<"\t"<<endl;
cout<<"-----------------------------------------\n";
for(x=0;x<y;x++)
{
if (pegawai[x].jam_kerja>7)
pegawai[x].gaji_harian=((pegawai[x].jam_kerja-7)*(pegawai[x].gaji_60*15)+(7*pegawai[x].gaji_60));
else
pegawai[x].gaji_harian=pegawai[x].jam_kerja*pegawai[x].gaji_60;
cout<<pegawai[x].nama<<"\t"<<pegawai[x].ID<<"\t"<<pegawai[x].jam_kerja<<"\tRp "<<pegawai[x].gaji_harian<<"\t";
cout<<endl;
}
cout<<endl;
}
Tidak ada komentar:
Posting Komentar