0% found this document useful (0 votes)
14 views11 pages

C Project

This document describes a C programming project for a hotel reservation system. The program allows customers to reserve hotel rooms of different types and view their bill. It stores customer information in structures and has functions for the menu, viewing reports, checking room availability, getting hotel information, making a reservation, and calculating the total bill. The main function calls the menu function in a do-while loop to allow customers to select different options until they choose to exit.

Uploaded by

006 Sahib Ahmad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views11 pages

C Project

This document describes a C programming project for a hotel reservation system. The program allows customers to reserve hotel rooms of different types and view their bill. It stores customer information in structures and has functions for the menu, viewing reports, checking room availability, getting hotel information, making a reservation, and calculating the total bill. The main function calls the menu function in a do-while loop to allow customers to select different options until they choose to exit.

Uploaded by

006 Sahib Ahmad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

C Programming Project

HOTEL RESERVATION

NAME: SAHIB AHMAD SHEIKH (2021BCSE006)


NAME: WASEEMA FIRDOUS (2021BCSE083)

PROFESSOR: HUSHMAT AMIN


PROJECT AIMS:

1) This program can be used to reserve hotel


rooms with different variations of rooms
with different specification and rent.

2) This program has inbuilt billing system,


which automatically calculates total bill
amount to be paid by customer.

3) Program provides option to see details of


customer
4) Program lets you check details of hotel
rooms and different types of rooms like king
suit traveler with different rents.

Program description:

In this program we used structure to store


customer information.
Then defined a function menu to display
options to choose.
Other function we defined is report function
which shows details of those customers who
have reported.
Third function we defined shows available
rooms.
Fourth function we defined gives information
about hotel.
Fifth function we defined lets us book room
by providing some basic details.
Sixth function we defined calculates total bill
amount to be paid.
Then at last in main function , we called
menu function and store character which it
returns in variable (option).
Then call different functions depending upon
option chosen using switch case till option
chosen is not “exit” by involving do while
loop.

CODE:

It’s editable code …..


//code starts here
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <stdlib.h>

int sR = 10, kR = 20, tR = 30, totRes = 0;

struct Reservation
{
char custName[30], roomType;
int dD, dM, dY, perDay, noOfPer, resid, noOfRoom;
float billAmt;
} sRes[90];

char menu()
{

printf("+-----------------------------------+ \n");

printf("| D:Data | \n");

printf("+-----------------------------------+ \n");

printf("| H:Hotel Information | \n");

printf("+-----------------------------------+ \n");

printf("| A:Availability |\n");

printf("+-----------------------------------+ \n");

printf("| R:Reservation | \n");

printf("+-----------------------------------+\n");

printf("| E:Exit |\n");

printf("+-----------------------------------+\n");

printf("\n Enter the choice:");

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()
{

printf("Room Information: \n");

printf("\n SUIT:Total=%d \n", sR);

printf("King:Total=%d \n", kR);

printf("Travel:Total=%d \n", tR);


}

void hotelinfo()
{

printf("It is 15-story Hotel, Which is completely Air-condition, Spacious. \n");

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("It is 15-story Hotel, Which is completely Air-condition, Spacious. \n");

printf("Nearby: \n");

printf("Railway Station @ 50Mtr. \n");

printf("SUMMATION Education Office @ 100Mtr. \n");

printf("Room Information:\n");

printf("+--------------------------------------------------+---------+\n");

printf("| Room Type | Information | Price | \n");

printf("|-----------+--------------------------------------+---------| \n");

printf("| SUIT | 2Rooms, 1sq-Mtr Sofa and King Bed | 10000/- | \n");

printf("|-----------+--------------------------------------+---------| \n");

printf("|KING. | 60Sq-Meter,Sofa, Table and King Bed | 5000/- | \n");


printf("|-----------+--------------------------------------+---------| \n");

printf("| Travel | 40Sq-Meter, Table, Queen Bed | 2500/- | \n");

printf("_____________________+ \n");
}

void res()
{

printf("Enter Your Name: \n");


gets(sRes[totRes].custName);
fflush(stdin);
printf("Enter Date one by one in order shown: dd/mm/yy");
scanf("%d", &sRes[totRes].dD);
fflush(stdin);
scanf("d", &sRes[totRes].dM);
fflush(stdin);
scanf("%d", &sRes[totRes].dY);
fflush(stdin);
printf("\n Enter No days");
scanf("%d", &sRes[totRes].perDay);
fflush(stdin);
printf(" \n Enter Room Type(S/K/T)");
scanf("%c", &sRes[totRes].roomType);
fflush(stdin);
printf("Enter No of Persons: \n");
scanf("%d", &sRes[totRes].noOfPer);
fflush(stdin);

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':

printf("\nThank YOU.....Visit Again..... %c", 2);


break;
}
getch();

} while (option != 'e' && option != 'E');


}

//CODE ENDED HERE

Demo:
This was simple demo of our application…

You might also like