#include <iostream>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
double GP=0;
class Pegawai
{ private :
char NIP[13];
char Nama[100];
char Gol[15];
double GaPok;
public:
void Input_Data()
{
cout << "Input Data Pegawai"<<endl;
cout << "NIP :";cin>>NIP;
fflush(stdin);
cout << "Nama :";cin>>Nama;
cout << "Golongan [II/A] :";cin>>Gol;
cout << "Gaji Pokok Rp:";cin>>GaPok;
GP=GaPok;
}
void Cetak_Data()
{
cout << "Informasi Data Pegawai"<<endl;
cout << "NIP :" << NIP << endl;
cout << "Nama :" << Nama << endl;
cout << "Golongan [II/A] :" << Gol << endl;
cout << "Gaji Pokok Rp:" << GaPok << endl;
}
};
class Manager: public Pegawai
{ char KodeJabatan[10];
char NamaJabatan[45];
double Tunjangan;
public:
void Input_Data()
{
Pegawai::Input_Data();
cout << "Kode Jabatan :";cin>>KodeJabatan;
cout << "Nama Jabatan :";cin>>NamaJabatan;
cout << "Besar Tunjangan Rp:";cin>>Tunjangan;
}
void Cetak_Data()
{
Pegawai::Cetak_Data();
cout << "Kode Jabatan :" << KodeJabatan << endl;
cout << "Nama Jabatan :" << NamaJabatan << endl;
cout << "Besar Tunjangan Rp:" << Tunjangan << endl;
cout << "Gaji Total Rp:" << Tunjangan+GP << endl;
}
};
void main()
{
char pil='0';
Pegawai P1;
Manager M1;
clrscr();
cout << "Menu Pilihan "<<endl;
cout << "[1].Input Data Pegawai"<<endl;
cout << "[2].Input Data Manager"<<endl;
cout << "[3].Tampil Data Pegawai"<<endl;
cout << "[4].Tampil Data Manager"<<endl;
cout << "[5].Exit (Kalua)"<<endl;
while (pil!='5')
{
cout << "Pilahan Anda [1..5]";cin>>pil;
switch (pil)
{
case '1':
P1.Input_Data();
break;
case '2':
M1.Input_Data();
break;
case '3':
P1.Cetak_Data();
break;
case '4':
M1.Cetak_Data();
break;
case '5':
exit(1);
default:
cout << endl << "Anda Salah Pilih Seharusnya [1..5]"<<endl;
break;
}
}
}
Tidak ada komentar:
Posting Komentar