In: Computer Science
IN C.
This is a hotel room and guest management system, the main purpose of this procedure is to manage the room, manage the guest account and check the hotel performance (how many rooms are booked, etc.). There are two types of people who use this system, the manager and the receptionist.
As a manager, there are three options:
Set/adjust room levels and rates for each level
Detail: there are 80 rooms in the hotel, 10 on each floor, eight floors. All rooms have four levels: **, ***, *** and VIP. I think the operation here is that the manager can manually input a room number, and then divide it into one of the four levels. Each level has a fixed price.
2. Manage customer information (add/adjust/delete)
Detail:The manager will be able to see a library of users and (add/remove/modify) the customer in it, as well as label some users with special VIP codes that will allow them to stay in VIP rooms.
3. Check hotel status
Detail: this means that the manager can see how many people have stayed in the hotel, if the most simplified, is the room occupancy rate.
SOURCE CODE
#include
void add();//this function for booking new room
void del();//this function for deleting the room
void modify();//this function is to adjust the customers in a
room
int a[90];//this array for storing the information of all
room
int n;//this is for storing the room number entered by the
manager
int main()
{
int m;//this for storing selected one option from the menu
int i;
int z;
int s=0;//this for storing the total number of customers in the
hotel
while(1){
printf("\nSelect one option\n1.add(for adding new
room)\n2.remove(for removing the room )\n3.modify(adjust the
memebrs in the room)\n4.exit");
scanf("%d",&m);
if(m==4)//if we wanted to exit
break;//loop will
terminate
printf("\n Enter room number the room number is in the range of
0-79 ");
scanf("%d",&n);
//-------------------------------------------
//this is for giving the level of the room
z=n%4;
printf("\n The level of the room is %d",z);
if(z==4)
printf("\n The level of the room is VIP");
//------------------------------------------------
if(m==1)
add();//calling add
function
else if(m==2)
del();//calling the del
function
else if(m==3)
modify();//calling the
modify function
}
for(i=0;i<80;i++)
{
if(a[i]!=0)//the allocated rooms only enter into
inside
{
printf("\nroom
%d:customers %d",i,a[i]);//printing the customers in each allocated
room
s=s+a[i];
}
}
printf("\nthe totla customers in hotel %d",s);//printing totol
customers
return 0;
}
void add()
{
int d;
if(a[n]==0)
{ printf("\nEnter number of
customers ");
scanf("%d",&d);
a[n]=d;//adding the
customers to the room
}
else
printf("\nThe room is
already allocated");
}
void del()
{
if(a[n]==0)
printf("\nThe room is
already empty");
else
{
a[n]=0;//removing the
customers from the room and room is making empty
printf("\nthe room is
removed");
}
}
void modify()
{
int e,d;
printf("\n1.add the memebrs to the room
\n2.remove the memebrs from the room");
scanf("%d",&e);
if(a[n]==0)//if room is empty we can't modify
the customers
printf("\nThe room is
already empty");
else{
printf("\n Enter the
number of customers");
scanf("%d",&d);
if(e==1){//for adding members into the allocated
room
a[n]=a[n]+d;
printf("\n %d new
customers added to the room %d",d,n);
}
else if(e==2){//removing members from the
allocated room
a[n]=a[n]-d;//subracting
the customers from the already existing customers
if(a[n]>0)
printf("\n %d customers
are removed from room %d",d,n);
else
printf("\n Invalid customers number");
}
else
printf("\nselect valid
option");
}
}
OUTPUT