struct karyawan {
string nama;
char golongan;
int jumlah_anak;
int gapok;
int JA;
int Ttl_Gaji;
int Ttl_jmlank;
};
int main() {
int n;
cout << "Masukan Jumlah Karyawan : ";
cin >> n;
karyawan kry[10];
int total_jumlah_anak;
int total_tunjangan_anak;
int total_gaji_keseluruhan;
for (int i = 0; i < n; i++) {
cout << "Masukan Data Karyawan Ke - " << i + 1 << endl;
cout << "Masukan Nama Karyawan : ";
cin >> kry[i].nama;
cout << "Masukan Golongan : ";
cin >> kry[i].golongan;
cout << "Masukan Jumlah Anak : ";
cin >> kry[i].jumlah_anak;
cout << "===============================================================================================" << endl;
if (kry[i].golongan == 'A') {
kry[i].gapok = 600000;
} else if (kry[i].golongan == 'B') {
kry[i].gapok = 800000;
} else if (kry[i].golongan == 'C') {
kry[i].gapok = 1200000;
}
if (kry[i].jumlah_anak == 1 || kry[i].jumlah_anak == 2) {
kry[i].JA = kry[i].jumlah_anak * 300000;
} else if (kry[i].jumlah_anak > 2) {
kry[i].JA = 800000;
}
kry[i].Ttl_Gaji = kry[i].gapok + kry[i].JA;
total_jumlah_anak += kry[i].jumlah_anak;
total_tunjangan_anak += kry[i].JA;
total_gaji_keseluruhan += kry[i].Ttl_Gaji;
}
system("cls");
cout << "===============================================================================================" << endl;
cout << "NO\tNama Karyawan\tGol\tGaji Pokok\tJml.Anak\tTunj.Anak\tTotal Gaji" <<endl;
cout << "===============================================================================================" << endl;
for (int i = 0; i < n; i++) {
cout << i+1 << "\t" <<kry[i].nama << "\t" <<kry[i].golongan << "\t" <<kry[i].gapok <<" \t" <<kry[i].jumlah_anak <<" \t" <<kry[i].JA << " \t" << kry[i].Ttl_Gaji <<endl;
}
cout << "===============================================================================================" << endl;
cout << "Total Jumlah Anak = " << total_jumlah_anak << endl;
cout << "Total Tunjangan Anak = " << total_tunjangan_anak << endl;
cout << "Total Gaji Keseluruhan = " << total_gaji_keseluruhan << endl;
No comments:
Post a Comment