C Project
C Project
HOTEL RESERVATION
Program description:
CODE:
struct Reservation
{
char custName[30], roomType;
int dD, dM, dY, perDay, noOfPer, resid, noOfRoom;
float billAmt;
} sRes[90];
char menu()
{
printf("+-----------------------------------+ \n");
printf("+-----------------------------------+ \n");
printf("+-----------------------------------+ \n");
printf("+-----------------------------------+ \n");
printf("+-----------------------------------+\n");
printf("+-----------------------------------+\n");
return (getche());
}
void report()
{
int i;
if (totRes == 0)
{
printf("\n No Info to display ");
}
else
{
for (i = 0; i < totRes; i++)
{
printf("\n ID:4%d Name:%s", sRes[i].resid, sRes[i].custName);
printf("\n Date:%d-%d Days:%d Room:%c", sRes[i].dD, sRes[i].dM, sRes[i].perDay,
sRes[i].roomType);
printf("\n Person:%d No of Room:%d Amt:%6.0f", sRes[i].noOfPer, sRes[i].noOfRoom,
sRes[i].billAmt);
printf("\n------------------------------------------------------------------------
-----------------\n");
}
}
}
void roomAvl()
{
void hotelinfo()
{
printf("There are total two Restaurants and one Bar and total 60 Rooms \n");
printf("Amenities: \n");
printf("WIFI, Telephone, 24 Hour Bar & Restaurant and Room Service \n");
printf("Nearby: \n");
printf("Room Information:\n");
printf("+--------------------------------------------------+---------+\n");
printf("|-----------+--------------------------------------+---------| \n");
printf("| SUIT | 2Rooms, 1sq-Mtr Sofa and King Bed | 10000/- | \n");
printf("|-----------+--------------------------------------+---------| \n");
printf("_____________________+ \n");
}
void res()
{
sRes[totRes].noOfRoom = 1;
if (sRes[totRes].noOfPer > 3)
{
sRes[totRes].noOfRoom = 0;
sRes[totRes].noOfRoom += (sRes[totRes].noOfPer / 3);
if (sRes[totRes].noOfPer % 3 != 0)
;
sRes[totRes].noOfRoom++;
}
bill();
}
void bill()
{
float damt;
char ty[10];
switch (sRes[totRes].roomType)
{
case 's':
case 'S':
strcpy(ty, "SUIT");
damt = 10000;
sR = sR - (sRes[totRes].perDay * sRes[totRes].noOfRoom);
break;
case 'k':
case 'K':
strcpy(ty, "King");
damt = 5000;
kR = kR - (sRes[totRes].perDay * sRes[totRes].noOfRoom);
break;
case 't':
case 'T':
strcpy(ty, "Travel");
damt = 2500;
tR = tR - (sRes[totRes].perDay * sRes[totRes].noOfRoom);
break;
}
sRes[totRes].billAmt = sRes[totRes].perDay * damt * sRes[totRes].noOfRoom;
printf("Bill \n");
printf("+----------------------------------------------------------+ \n");
printf("| Room Type | Total Days | Per day | No of Rooms | Price | \n");
printf("+-------------+-----------+-----------+------------+----------+ \n");
printf("| %s | %d | %d | %d | %1.0f \n", ty,
sRes[totRes].perDay, damt, sRes[totRes].noOfRoom, sRes[totRes].billAmt);
printf("+-------------+-----------+------------+-------------+---------+ \n");
printf("|Total Bill: %8.0f | \n",
sRes[totRes].billAmt);
printf("|---------------------------------------------------------------| \n");
sRes[totRes].resid = totRes + 1;
printf("\n Reservation ID=%d", sRes[totRes].resid);
totRes++;
}
void main()
{
printf(" BOOKING MADE EASY........................EBOOKING \n\n \n");
char option;
do
{
option = menu();
switch (option)
{
case 'd':
case 'D':
report();
break;
case 'h':
case 'H':
hotelinfo();
break;
case 'a':
case 'A':
roomAvl();
break;
case 'r':
case 'R':
res();
break;
case 'e':
case 'E':
Demo:
This was simple demo of our application…