Program of Hotel in OOPs and Filling in C++

#include<iostream>
#include<conio.h>
#include<string>
#include<fstream>

using namespace std;

class hotel
{
public:
int floor;
int room;
int parking;
int rooms();
int floors();
int rent();
int food();
int parking_charges();
int laundry_service();

};
int hotel::rooms()
{
return(room);
}
int hotel::floors()
{
return(floor);
}
int hotel::rent()
{
return(room*floor*100);
}
int hotel::parking_charges()
{
return(5*room);
}
int hotel::food()
{
return(floor*50);
}
int hotel::laundry_service()
{
return(floor*30);
}

void main()
{
ofstream myfile("ahzam.txt");
myfile.is_open();
char name[25];
string n;
int i,ch;
hotel swiss_hotel;

cout<<"\t**************************************************************\n";
cout<<"\t*****************----------------------------*****************\n";
cout<<"\t***************** WELCOME TO THE SWISS HOTEL *****************\n";
cout<<"\t*****************----------------------------*****************\n";
cout<<"\t**************************************************************\n";

myfile<<"**************************************************************\n";
myfile<<"*****************----------------------------*****************\n";
myfile<<"***************** WELCOME TO THE SWISS HOTEL *****************\n";
myfile<<"*****************----------------------------*****************\n";
myfile<<"**************************************************************\n\n";
 
cout<<"\nPress 1.Superior Deluxe Room 2.Executive Deluxe Room 3.Deluxe Room 4.Exit\n\n";

cout<<"Enter Your Choice :";
cin>>ch;

switch(ch)
{
case 1:

myfile<<"******************* Superior Deluxe Room **********************\n";
cout<<"\n\t******************* Superior Deluxe Room **********************\n";

myfile<<"*********************** RESERVATION ***************************\n";
cout<<"\t*********************** RESERVATION ***************************\n";

cout<<"RATING :***** Stars";
myfile<<"\nRATING :***** Stars";

cout<<"\nEnter Your Name Sir :";
    cin>>name;

cout<<"\nEnter Your Contact No :";
cin>>i;

cout<<"\nRooms Booked :26\n";
cout<<"\nLimited Rooms Available :10\n";

cout<<"\nEnter No Of Rooms You Want To Book :";
cin>>swiss_hotel.room;

cout<<"\nEnter Floor :";
cin>>swiss_hotel.floor;
   
cout<<"\nDo You Want Lunch Sir Yes/No ? ";
cin>>n;

cout<<"\nDo You Want Valet Car Parking Sir Yes/No ? ";
cin>>n;

cout<<"\nSir Your Name Is "<<name;
cout<<"\nYou Have booked "<<swiss_hotel.rooms()<<" Rooms";
cout<<"\nYour Floor is "<<swiss_hotel.floors()<<"th";
cout<<"\nYour Lunch Charges is :$"<<swiss_hotel.food();
cout<<"\nYour Laundry Charges is :$"<<swiss_hotel.laundry_service();
cout<<"\nCar Parking Charges is :$"<<swiss_hotel.parking_charges();
cout<<"\nTotal Rent is $"<<swiss_hotel.rent()<<" per day";
cout<<"\n********Thankyou Sir*******";

myfile<<"\n\nYour Name Is "<<name;
myfile<<"\n\nSir You Have booked "<<swiss_hotel.rooms()<<" Rooms";
myfile<<"\nYour Floor is "<<swiss_hotel.floors()<<"th";
myfile<<"\nYour Lunch Charges is :$"<<swiss_hotel.food();
myfile<<"\nYour Laundry Charges is :$"<<swiss_hotel.laundry_service();
myfile<<"\nCar Parking Charges is :$"<<swiss_hotel.parking_charges();
myfile<<"\nTotal Rent is $"<<swiss_hotel.rent()<<" per day";
myfile<<"\n\n********Thankyou Sir*******";


break;
case 2:
cout<<"\n\t******************* Executive Deluxe Room *********************\n";
myfile<<"******************* Executive Deluxe Room *********************\n";

cout<<"\t*********************** RESERVATION ***************************\n";
myfile<<"*********************** RESERVATION ***************************\n";

cout<<"RATING :**** Stars";
myfile<<"\nRATING :**** Stars\n";

cout<<"\nEnter Your Name Sir :";
cin>>name;

cout<<"\nEnter Your Contact No :";
cin>>i;

cout<<"\nRooms Booked :32\n";
cout<<"\nRooms Available :15\n";

cout<<"\nEnter No Of Rooms You Want To Book :";
cin>>swiss_hotel.room;

cout<<"\nEnter Floor :";

cin>>swiss_hotel.floor;
    cout<<"\nDo You Want Lunch Sir Yes/No ? ";
cin>>n;

cout<<"\nDo You Want Valet Car Parking Sir Yes/No ? ";
cin>>n;

    cout<<"\nSir Your Name Is "<<name;
cout<<"\nYou Have booked "<<swiss_hotel.rooms()<<" Rooms";
cout<<"\nYour Floor is "<<swiss_hotel.floors()<<"th";
cout<<"\nYour Lunch Charges is :$"<<swiss_hotel.food();
cout<<"\nYour Laundry Charges is :$"<<swiss_hotel.laundry_service();
cout<<"\nCar Parking Charges is :$"<<swiss_hotel.parking_charges();
cout<<"\nTotal Rent is $"<<swiss_hotel.rent()<<" per day";
cout<<"\n********Thankyou Sir*******";

myfile<<"\nYour Name Is "<<name;
myfile<<"\n\nSir You Have booked "<<swiss_hotel.rooms()<<" Rooms";
myfile<<"\nYour Floor is "<<swiss_hotel.floors()<<"th";
myfile<<"\nYour Lunch Charges is :$"<<swiss_hotel.food();
myfile<<"\nYour Laundry Charges is :$"<<swiss_hotel.laundry_service();
myfile<<"\nCar Parking Charges is :$"<<swiss_hotel.parking_charges();
myfile<<"\nTotal Rent is $"<<swiss_hotel.rent()<<" per day";
myfile<<"\n\n********Thankyou Sir*******";
break;

case 3:
cout<<"\n\t*********************** Deluxe Room **************************\n";
myfile<<"*********************** Deluxe Room **************************\n";

cout<<"\t*********************** RESERVATION **************************\n";
myfile<<"*********************** RESERVATION **************************\n";

cout<<"RATING :*** Stars";
myfile<<"\nRATING :*** Stars\n";

cout<<"\nEnter Your Name Sir :";
cin>>name;

cout<<"\nEnter Your Contact No :";
cin>>i;

cout<<"\nRooms Booked :35\n";
cout<<"\nRooms Available :25\n";

cout<<"\nEnter No Of Rooms You Want To Book :";
cin>>swiss_hotel.room;

cout<<"\nEnter Floor :";
cin>>swiss_hotel.floor;
 
cout<<"\nDo You Want Lunch Sir Yes/No ? ";
cin>>n;

cout<<"\nDo You Want Valet Car Parking Sir Yes/No ? ";
cin>>n;

    cout<<"\nSirYour Name Is "<<name;
cout<<"\nSgYou Have booked "<<swiss_hotel.rooms()<<" Rooms";
cout<<"\nYour Floor is "<<swiss_hotel.floors()<<"th";
cout<<"\nYour Lunch Charges is :$"<<swiss_hotel.food();
cout<<"\nYour Laundry Charges is :$"<<swiss_hotel.laundry_service();
cout<<"\nCar Parking Charges is :$"<<swiss_hotel.parking_charges();
cout<<"\nTotal Rent is $"<<swiss_hotel.rent()<<" per day";
cout<<"\n********Thankyou Sir*******";

    myfile<<"\nSir Your Name Is "<<name;
myfile<<"\n\nYou Have booked "<<swiss_hotel.rooms()<<" Rooms";
myfile<<"\nYour Floor is "<<swiss_hotel.floors()<<"th";
myfile<<"\nYour Lunch Charges is :$"<<swiss_hotel.food();
myfile<<"\nYour Laundry Charges is :$"<<swiss_hotel.laundry_service();
myfile<<"\nCar Parking Charges is :$"<<swiss_hotel.parking_charges();
myfile<<"\nTotal Rent is $"<<swiss_hotel.rent()<<" per day";
myfile<<"\n\n********Thankyou Sir*******";

break;

case 4:
exit(0);
cout<<name<<endl;

myfile.close();
}
getch();
}







No comments:

Post a Comment