porgram cpp .class pegawai


NAMA : vasko edo minter

NIM : 071402009

// latihan_modul 5..bagian no_:1.cpp

#include<iostream.h>

#include<string.h>

class pegawai

{

protected:

char nama[64];

char telepon_rumah[64];

char telepon_kantor[64];

char laporan[64];

public:

pegawai(char*nama,char*telepon_rumah,char*telepon_kantor,char*laporan);

void show_pegawai();

~pegawai(){}

};

class manager:public pegawai

{

private:

int level_gaji;

int level_bonus;

char asistent[64];

public:

manager(char*nama,char*telepon_rumah,char*telepon_kantor,char*laporan,int level_gaji,

int level_bonus,char*assistent);

void show_manager();

};

class pegawai_tetap:public pegawai

{

private:

float upah;

public:

pegawai_tetap(char*nama,char*telepon_rumah,char*telepon_kantor,char*laporan,float upah);

void show_pegawai_tetap();

};

class pegawai_tidak_tetap:public pegawai

{

private:

float upah;

float lembur;

public:

pegawai tidak tetap(char*nama,char*telepon_rumah,char*telepon_kantor,char*laporan,

float upah,float lembur);

void show_pegawai tidaktetap();

};

pegawai::pegawai(char*nama,char*telepon_rumah,char*telepon_kantor,char*laporan)

{

strcpy(pegawai::nama,nama);

strcpy(pegawai::telepon_rumah,telepon_rumah);

strcpy(pegawai::telepon_kantor,telepon_kantor

strcpy(pegawai::laporan,laporan);

}

manager::manager(char*nama,char*telepon_rumah,char*telepon_kantor,char*laporan,int level_gaji,

int level_bonus,char*assistent);

pegawai(nama,telepon_rumah,telepon_kantor,laporan)

{

strcpy(manager::assistent,assistent);

manager::level_bonus==level_bonus;

manager::level_gaji=level_gaji;

}

void manager::show_manager()

{

show_pegawai();

cou<<“level gaji:”<<level_gaji<<endl;

cout<<“assistent:”<<assistent<<endl;

}

pegawai_tetap::pegawai tetap(char*nama,char*telepon_rumah,char*telepon_kantor,

char*laporan,float upah);pegawai(nama,telepon_rumah,telepon_kantor,laporan)

{

pegawai_tetap::upah=upah;

}

void pegawai_tetap::show pegawai_tetap()

{

show_pegawai();

cout<<“upah:”<<upah<<endl;

}

pegawai_tidak_tetap::pegawai_tidak tetap(char*nama,char*telepon_rumah,char*telepon_kantor,

char*laporan,float upah);pegawai(nama,telepon_rumah,telepon_kantor,laporan)

{

pegawai_tidak tetap::upah=upah;

pegawai_tidak tetap::lembur=lembur;

}

void_pegawai_tidaktetap::show_pegawai_tidak tetap()

}

show_pegawai();

cout<<“upah:”<<upah<<endl;

cout<<“lembur:”<<lembur<<endl;

}

int main()

{

manager perusahaan(“Ahmad dani”,”(061)4333321″,”(061)4345343″,”lenni”,3000000,2000000,”susi”;

pegawai_tetap adm(“syamsul”,”(061)886432″,”(061)673899″,”hendri”,800000);

pegawi_tidak tetap cs(“mirna”,”(061)783629″,”(061)456732″,’tatono”,500000,200000);

perusahaan.show_manager();

adm.show_pegawai_tetap();

cs.show_pegawai_tidaktetap();

return 0;

}

Tinggalkan Balasan

Please log in using one of these methods to post your comment:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s