#include <iostream>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
double BiayaKamar=0;
class Hotel
{ private :
int NoKamar;
char Jenis[45];
char Type[100];
double HargaKamar;
public:
void Input_Data()
{
cout << "Input Data Hotel"<<endl;
cout << "Nomor Kamar :";cin>>NoKamar;
cout << "Jenis Kamar :";cin>>Jenis;
cout << "Type Kamar :";cin>>Type;
cout << "Harga Kamar Rp:";cin>>HargaKamar;
BiayaKamar=HargaKamar;
}
void Cetak_Data()
{
cout << "Informasi Data Hotel"<<endl;
cout << "Nomor Kamar :"<< NoKamar<<endl;
cout << "Jenis Kamar :"<<Jenis<<endl;
cout << "Type Kamar :"<<Type<<endl;
cout << "Harga Kamar Rp:"<<HargaKamar<<endl;
}
};
class Transaksi: public Hotel
{ char IdTamu[15];
char NamaTamu[45];
int TglMasuk;
int TglKeluar;
float BiayaAdm;
public:
void Input_Data()
{
Hotel::Input_Data();
cout << "Identitas Tamu :";cin>>IdTamu;
cout << "Nama Tamu :";cin>>NamaTamu;
cout << "Tanggal Masuk :";cin>>TglMasuk;
cout << "Tanggal Keluar :";cin>>TglKeluar;
cout << "Biaya Adm. Rp:";cin>>BiayaAdm;
}
void Cetak_Data()
{ double TotalBiaya;
Hotel::Cetak_Data();
cout << "Identitas Tamu :"<<IdTamu<<endl;
cout << "Nama Tamu :"<<NamaTamu<<endl;
cout << "Tanggal Masuk :"<<TglMasuk<<endl;
cout << "Tanggal Keluar :"<<TglKeluar<<endl;
cout << "Biaya Adm. Rp:"<<BiayaAdm<<endl;
TotalBiaya=((TglKeluar-TglMasuk)*BiayaKamar)+ BiayaAdm;
cout << "Total Biaya Rp:"<<TotalBiaya<<endl;
}
};
void main()
{
char pil='0';
Hotel H1;
Transaksi T1;
clrscr();
cout << "Menu Pilihan "<<endl;
cout << "[1].Input Data Hotel"<<endl;
cout << "[2].Input Data Transaksi"<<endl;
cout << "[3].Tampil Data Hotel"<<endl;
cout << "[4].Tampil Data Transaksi"<<endl;
cout << "[5].Exit (Ke Systems)"<<endl;
while (pil!='5')
{
cout << "Pilahan Anda [1..5]";cin>>pil;
switch (pil)
{
case '1':
H1.Input_Data();
break;
case '2':
T1.Input_Data();
break;
case '3':
H1.Cetak_Data();
break;
case '4':
T1.Cetak_Data();
break;
case '5':
exit(1);
default:
cout << endl << "Anda Salah Pilih Seharusnya [1..5]"<<endl;
break;
}
}
}
Tidak ada komentar:
Posting Komentar