Contoh program hotel C++

Contoh program hotel C++

Berikut adalah contoh program hotel yang dibuat menggunakan bahasa pemprogramman c++

C++
#include<iostream>
#include<conio.h>
#include<stdlib.h>
using namespace std;

void home();
void satu();
void dua();
void tiga();

main()
{
	int pilih;
	
	cout<<"============================================================="<<endl;
	cout<<"    	WELCOME TO E-POSTLAB RESORT"<<endl;
	cout<<"    	Dubai, Phone 123 456 768"<<endl;
	cout<<"=============================================================="<<endl;
	cout<<"=============================================================="<<endl<<endl<<endl;
	
	cout<<"1. Fasilitas Resort"<<endl;
	cout<<"2. Pemesanan Kamar Resort"<<endl;
	cout<<"3. Pemesanan Fasilitas Resort Lainnya"<<endl<<endl;
	cout<<"Pilih menu yang Anda inginkan [1/2/3]= ";
	cin>>pilih;
	
	if (pilih==1)
	{
		satu();
	}
	else if (pilih==2)
	{
		dua();
	}
	else if (pilih==3)
	{
		tiga();
	}
	else
	{
		cout<<"Anda salah memasukkan pilihan!";
	}
}

void satu()
{
	satu:
	/*fasilitas hotel*/
	system("cls");
	int info;
	char kb;
	
	cout<<"		*Fasilitas e-Postlab Resort*"					<<endl<<endl;
	cout<<"Fasilitas Kamar"										<<endl;
	cout<<"________________________________________________" 	<<endl;
	cout<<"No. Tipe	|" <<"	Tipe Kamar	|"			<<endl;
	cout<<"________________________________________________|" 	<<endl;
	cout<<"	1	|   Deluxe Room			|"						<<endl;
	cout<<"	2	|   Romantic Room		|"						<<endl;
	cout<<"	3	|   Family Room			|"						<<endl;
	cout<<"	4	|   Deluxe-Connecting Room	|"					<<endl;
	cout<<"	5	|   Suite Room			|"						<<endl;
	cout<<"________________________________________________|" 	<<endl <<endl;
	
	cout<<"		Fasilitas Lainnya" <<endl;
	cout<<"-Layanan kamar 24 jam" <<"\t"	<<"-Penyewaan Sepeda" <<"\t"	<<"-Kedai kopi"	<<"\t"			<<endl;
	cout<<"-Gratis wifi" <<"\t" <<"\t" 		<<"-Layanan Laundry" <<"\t" 	<<"-Kolam renang" <<"\t"		<<endl;
	cout<<"-Rumah Makan" <<"\t" <<"\t" 		<<"-AC" <<"\t" <<"\t" <<"\t" 	<<"-Gratis Perlengkapan Mandi"	<<endl;
	cout<<"-Spa" <<"\t"	<<"\t"	<<"\t"		<<"-Telepon" <<"\t"	<<"\t"		<<"Fasilitas Ruang Pertemuan"	<<endl<<endl;
	
	cout<<"Masukan pilihan Anda untuk melihat informasi di atas [1/2/3/4/5]= ";
	cin>>info;
	
	system ("cls");
	switch (info)
	{
	case 1:
		cout<<"		*Deluxe Room*"				<<endl <<endl;
		cout<<"Jenis Tempat Tidur:" <<endl <<"1. Single Bed	Rp 400000,-/hari" <<endl <<"2. Double Bed	Rp 500000,-/hari" <<endl <<endl;
		cout<<"Fasilitas Ruangan:" <<endl <<"-AC" <<endl <<"-TV 21 inch LCD lokal channel" <<endl <<"-Bathub dan shower air panas" <<endl;
		cout<<"-DVD player" <<endl <<"-Kulkas" <<endl <<"-Wifi gratis" <<endl <<endl;
		break;
	case 2:
		cout<<"		*Romantic Room"				<<endl <<endl;
		cout<<"Jenis Tempat Tidur:" <<endl <<"King Bed	Rp 1000000,-/hari" <<endl <<endl;
		cout<<"Fasilitas Ruangan:" <<endl <<"-AC" <<endl <<"-TV 29 inch LCD lokal and internasional channel" <<endl <<"-Bathub dan shower air panas" <<endl;
		cout<<"-Minibar" <<endl <<"-Teras Pribadi" <<endl<<"-Dinner Romantic" <<endl <<"-Wifi gratis" <<endl <<"-DVD player" <<endl <<"-Kulkas" <<endl <<endl;
		break;
	case 3:
		cout<<"		*Family Room"				<<endl <<endl;
		cout<<"Jenis Tempat Tidur:" <<endl <<"single Bed dan king Bed	Rp 1000000,-/hari" <<endl <<endl;
		cout<<"2 Single Bed dan Double Bed	Rp 1200000,-/hari" <<endl <<endl;
		cout<<"Fasilitas Ruangan:" <<endl <<"-AC" <<endl <<"-TV 21 inch dan 29 inch LCD lokal channel" <<endl <<"-Bathub dan shower air panas" <<endl;
		cout<<"-Minibar" <<endl <<"-Dinner famaly" <<endl <<"-Wifi gratis" <<endl <<"-DVD player" <<endl <<"-Kulkas" <<endl <<"-Ruang Santai Dan Bermain Anak" <<endl <<endl;
		break;	
	case 4:
		cout<<"		*Deluxe Connecting Room"				<<endl <<endl;
		cout<<"Jenis Tempat Tidur:" <<endl <<"2 Double Bed	Rp 1500000,-/hari" <<endl <<endl;
		cout<<"Fasilitas Ruangan:" <<endl <<"-AC" <<endl <<"- 2 buah TV 29 inch LCD lokal channel" <<endl <<"-Bathub dan shower air panas" <<endl;
		cout<<"-Minibar" <<endl <<"-Wifi gratis" <<endl <<"-DVD player" <<endl <<"-Kulkas" <<endl <<"-Ruang Santai" <<endl <<endl;
		break;	
	case 5:
		cout<<"		*Suite Room"				<<endl <<endl;
		cout<<"Jenis Tempat Tidur:" <<endl <<"King Bed	Rp 2000000,-/hari" <<endl <<endl;
		cout<<"Fasilitas Ruangan:" <<endl <<"-AC" <<endl <<"- 2 buah TV 29 inch LCD lokal channel" <<endl <<"-Bathub dan shower air panas" <<endl;
		cout<<"-Minibar" <<endl <<"-Wifi gratis" <<endl <<"-DVD player" <<endl <<"-Kulkas" <<endl <<"-Ruang Santai" <<endl ;
		cout<<"-Teras Pribadi dan Pemandangan Pantai" <<endl <<"-Teras Pribadi dan Pemandangan Pantai" <<endl <<endl;
		break;	
	}
	cout<<"Apakah Anda ingin kembali atau memesan kamar?"<<endl;
	cout<<"[k] Kembali	[b] Booking = ";
	cin>>kb;
	
	if (kb=='k')
	{
		goto satu;
	}
	else if (kb=='b')
	{
		dua();
	}
}

void dua()
{
	/*pemesanan kamar*/
	char name[20];
	int t, jk, jk1, jk2, jk3, jk4, jk5, jk6, lama, iden, tipe;
	long int harga, harga1, harga2, harga3,harga4, harga5, harga6, totbiaya, biaya, biaya1,biaya2,biaya3,biaya4,biaya5,biaya6, dis, datein, dateout;
	
	system("cls");
	
	cout<<"		Pemesanan Kamar"		<<endl	<<"________________________________________________________" <<endl;
	cout<<"Tipe kamar"					<<endl;
	cout<<"1. Deluxe Room Single Bed"	<<endl;
	cout<<"2. Deluxe Room Double Bed"	<<endl;
	cout<<"3. Romantic Room"			<<endl;
	cout<<"4. Family Room"				<<endl;
	cout<<"5. Deluxe-Connecting Room"	<<endl;
	cout<<"6. Suite Room"				<<endl <<endl;
	cout<<"	*Pemesanan Kamar Hotel*"	<<endl <<endl;
	
	cout<<"Pemesan Kamar Atas Nama	= ";
	cin>>name;
	cout<<"No. Identitas KTP/SIM	= ";
	cin>>iden;
	
	cout<<"Jumlah tipe kamar	= ";
	cin>>tipe;
	
	for (int a=1; a<=tipe; a++)
	{
		cout<<"Tipe Kamar [1-6]= ";
		cin>>t;
		switch (t)
		{
		case 1:
			harga1=450000;	
			cout<<"Kamar Tipe 1: Deluxe Room Single Bed	Rp 450000,-/malam"	<<endl;
			cout<<"Jumlah pemesanan kamar	= ";
			cin>>jk1;
			break;
		case 2:
			harga2=500000;
			cout<<"Kamar Tipe 2: Deluxe Room Double Bed	Rp 500000,-/malam"	<<endl;
			cout<<"Jumlah pemesanan kamar	= ";
			cin>>jk2;
			break;
		case 3:
			harga3=750000;
			cout<<"Kamar Tipe 3: Romantic Room	Rp 750000,-/malam"			<<endl;
			cout<<"Jumlah pemesanan kamar	= ";
			cin>>jk3;
			break;
		case 4:
			harga4=1000000;
			cout<<"Kamar Tipe 4: Family Room	Rp 1000000/malam"			<<endl;
			cout<<"Jumlah pemesanan kamar	= ";
			cin>>jk4;
			break;
		case 5:
			harga5=1500000;
			cout<<"Kamar Tipe 5: Deluxe-Connecting Room	Rp 15000000/malam"		<<endl;
			cout<<"Jumlah pemesanan kamar	= ";
			cin>>jk5;
			break;
		case 6:
			harga6=2000000;
			cout<<"Kamar Tipe 6: Suite Room	Rp 2000000/malam"					<<endl;
			cout<<"Jumlah pemesanan kamar	= ";
			cin>>jk6;
			break;
		}
	}
	
	cout<<"Tanggal Check in [YYMMDD]= ";
	cin>>datein;
	cout<<"Tanggal Check out [YYMMDD]= ";
	cin>>dateout;	

	lama= dateout-datein;
	cout<<"Lama menginap	= " <<lama;
	
	biaya= ((jk1*harga1)*lama)+((jk2*harga2)*lama);
	
	if (lama<=6)
	{
		totbiaya= biaya;
	}
	else if (lama>=7)
	{
		totbiaya= biaya-(0.1*biaya);
	}
	else if (lama>=15);
	{
		totbiaya= biaya-(0.2*biaya);
	}
	
	system("cls");
	cout<<"Nama Pemesanan		= " <<name <<endl <<"No. Identitas KTP/SIM	= " <<iden 										<<endl;
	cout<<"Tanggal Check in	= " <<datein <<endl <<"Tanggal Check out	= " <<dateout 										<<endl <<endl;
	cout<<"________________________________________________________________________" 										<<endl;
	cout<<"Tipe Kamar	| Harga/Malam	| Jml Kamar | Lama Sewa | Total Biaya	|" 											<<endl;
	cout<<"________________________________________________________________________" 										<<endl;
	if (t==1)
	{
		cout<<"Deluxe Room SB	| Rp " <<harga1 <<",-" <<"\t| " <<jk1 <<"\t| " <<lama <<"\t|" <<" Rp " <<totbiaya <<",-	|";
	}
	else if (t==2)
	{
		cout<<"Deluxe Room DB	| Rp " <<harga2 <<",-" <<"\t| " <<jk2 <<"\t   | " <<lama <<"\t|"<<" Rp " <<totbiaya <<",-	|";
	}
	else if (t==3)
	{
		cout<<"Romantic Room	| Rp " <<harga3 <<",-" <<"\t| " <<jk3 <<"\t   | " <<lama <<"\t|"<<" Rp " <<totbiaya <<",-	|";
	}
	else if (t==4)
	{
		cout<<"Family Room		| Rp " <<harga4 <<",-" <<"\t| " <<jk4 <<"\t   | " <<lama <<"\t|"<<" Rp " <<totbiaya <<",-	|";
	}
	else if (t==5)
	{
		cout<<"Deluxe-Con Room	| Rp " <<harga5 <<",-" <<"\t| " <<jk5 <<"\t   | " <<lama <<"\t|"<<" Rp " <<totbiaya <<",-	|";
	}
	else if (t==6)
	{
		cout<<"Suite Room		| Rp " <<harga6 <<",-" <<"\t| " <<jk6 <<"\t   | " <<lama <<"\t|"<<" Rp " <<totbiaya <<",-	|";
	}
	
	cout<<endl <<"________________________________________________________________________" <<endl;
}

void tiga ()
{
	/*Fasilitas lainnya yang bisa disewa*/
	system("cls");
	
	int sewa,sewasingle, sewadouble, bb, sewarp,kembali;
	long int tosewasi,tosewado, bilau, tosewarp;
	cout<<"	*Pemesanan Fasilitas Resort Lainnya*" <<endl <<endl;
	cout<<"[1] Sewa Sepeda Single	Rp 15000/jam" <<endl <<"[2] Sewa Sepeda Double	Rp 30000/jam" <<endl;
	cout<<"[3] Laundry		Rp 10000/kg (min.2 kg)" <<endl <<"[4] Sewa Fasilitas Ruang Pertemuan	Rp 350000/jam" <<endl <<endl;
	cout<<"Pilih fasilitas yang diinginkan= ";
	cin>>sewa;
	
	system("cls");
	
	switch (sewa)
	{
	case 1:
		cout<<"Sewa Sepeda Single	Rp 15000/jam" <<endl;
		cout<<"Lama sewa= ";
		cin>>sewasingle;
		tosewasi= sewasingle*15000;
		cout<<"Anda harus membayar Rp " <<tosewasi <<",- untuk pemakaian " <<sewasingle <<" jam";
		break;
	case 2:
		cout<<"Sewa Sepeda Double	Rp 30000/jam" <<endl;
		cout<<"Lama sewa	= ";
		cin>>sewadouble;
		tosewado= sewadouble*30000;
		cout<<"Anda harus membayar Rp " <<tosewado <<",- untuk pemakaian " <<sewadouble <<" jam";
		break;
	case 3:
		cout<<"	Laundry Resort" <<endl;
		cout<<"Berat barang	= ";
		cin>>bb;
		
		if (bb==1)
		{
			cout<<"Tidak boleh laundry di bawah 1 kg" <<endl;
		}
		else
		{
			bilau= bb*10000;
			cout<<endl <<"Biaya yang Anda keluarkan  Rp " <<bilau <<",- untuk laundry " <<bb <<" kg";
		}
		break;
	case 4:
		cout<<"	Ruang Pertemuan Hotel" <<endl;
		cout<<"Lama sewa	= ";
		cin>>sewarp;
		tosewarp= sewarp*350000;
		cout<<"Biaya yang Anda keluarkan Rp " <<tosewarp <<",- untuk pemakaian gedung selama " <<sewarp <<" jam";
		break;
	}
	
	cout<<endl <<"__________________________________________________________" <<endl;
	cout<<"Apakah Anda Ingin Kembali [Y/T] = ";
	cin>>kembali;
	if (kembali=='y')
	{
		tiga();	
	}
	else if(kembali=='t')
	{
		system ("cls");
	}
	cout<<"	Terima Kasih Telah Mengunjungi e-Postlab Resort Kami"<<endl;
	cout<<" Sebagai Tempat untuk Beristirahat";
}
C++

Semoga bermanfaat