C S (Sahil)
C S (Sahil)
C S (Sahil)
UPPARWAHI
2) Acknowledgement
3) Project Background
4) Software Requirements
5) Module Definition
6) Coding
7) Output Screens
9) References
Certificate
This is to certify that Sahil Mohammed of
class XII Science of Ambuja Vidya
Niketan, Upparwahi has completed his
project under the supervision of Mr. Ravi
Kumar Sharma & Mr. Rajesh Sharma
sir. He has taken care and shown sincerity
in completion of this project.
Principal’s signature
Acknowledgement
Software:-
Hardware:-
Sub Modules:
Room menu:
It has total 6 menus that allow us to add/edit data in
vacancy table.
1) Insertinvacancy: To add data about the rooms
number, type , price, and availability in vacancy
table.
Customer Menu:
It has 3 menus which allow us to update, delete and
view the details of customers that are stored in the
customer table.
1) Updatecustomer: This allows us to update the
checkout date of a particular customer.
2) Customerreport:
Vacancy Table
Customer table
Code
import mysql.connector
from tabulate import tabulate
import pyfiglet
con=mysql.connector.connect(host='localhost',
database='hotel',
user='root',
password='sqlpass')
if con.is_connected():
print(pyfiglet.figlet_format("Welcome",font="starwars",justify="cent
er"))
else:
print("No Database found.")
def updatestatus():
RoomNO=int(input("Enter the Room number whose status you
have to change"))
status=input("Enter whether the room is vacant or occupied-")
query="update vacancy set Vacancy='{}' where
RoomNO={}".format(status,RoomNO)
cur=con.cursor()
cur.execute(query)
con.commit()
def updateprice():
def insertinvacancy():
RoomNO=int(input("Enter the Room number"))
Roomtype=input("Enter the room type")
Vacancy=input("Enter whether the room is vacant or occupied ")
FloorNO=int(input("Enter the floor NO"))
Price=int(input("Enter the Price of the room"))
query="insert into vacancy
values({},'{}','{}',{},{})".format(RoomNO,Roomtype,Vacancy,Floor
NO,Price)
cur=con.cursor()
cur.execute(query)
con.commit()
def updateroom():
choice=0
while choice!=3:
print("_________Enter the Choice__________")
print("1. To Update the status of the room...")
print("2. To Update the price of the room...")
print("3. Exit")
choice=int(input("Enter your choice -"))
if choice==1:
updatestatus()
elif choice==2:
updateprice()
elif choice==3:
exit
def deletevacancy():
r=int(input("Enter the room number of the record to be deleted"))
query="delete from vacancy where RoomNO={}".format(r)
cur=con.cursor()
cur.execute(query)
con.commit()
def displayvacancy():
l=[]
cur=con.cursor()
cur.execute("Select * from vacancy")
data=cur.fetchall()
for i in data:
l.append([i[0],i[1],i[2],i[3],i[4]])
print(tabulate(l,headers=["Room Number","Room
Type","Status","Floor no.","Price"],tablefmt="pretty"))
def Roombooking():
cur1=con.cursor()
Customer_name=input("Enter name of the customer")
Room_NO=int(input("Enter the room number"))
Checkin=input("Enter the date")
Checkout=input("Enter the date")
Phone_NO=int(input("Enter the Phone number"))
Aadhar_1=int(input("Enter the first four digits"))
Aadhar_2=int(input("Enter the digits"))
Aadhar_3=int(input("Enter the digits"))
query="insert into customer
values('{}',{},'{}','{}',{},{},{},{})".format(Customer_name,Room_N
O,Checkin, Checkout,Phone_NO, Aadhar_1,Aadhar_2,Aadhar_3)
cur=con.cursor()
cur.execute(query)
a="occupied"
cur1.execute("update vacancy set Vacancy=%s where
Room_NO=%s",(a,Room_NO))
con.commit()
print("Your room has been booked and your number
is",Room_NO)
def displaycustomer():
l=[]
cur=con.cursor()
cur.execute("Select * from customer")
data=cur.fetchall()
for i in data:
l.append([i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7]])
print(tabulate(l,headers=["Customer Name","Room No.","Checkin
Date","Checkout Date","Phone
No.","AadharNO.1","AadharNO.2","AadharNO.3"],tablefmt="pretty"
))
def deletecustomer():
r=int(input("Enter the Room number of Record to be deleted..."))
query="delete from customer where Room_NO={}".format(r)
cur=con.cursor()
cur.execute(query)
con.commit()
def updatecustomer():
RoomNO=int(input ("Enter the room number whose checkout date
is to be changed-"))
Date=input("Enter the date of checkout-")
query="update customer set Checkout='{}' where
Room_NO={}".format(Date,RoomNO)
cur=con.cursor()
cur.execute(query)
con.commit()
def Enquiry():
l=[]
cur=con.cursor()
cur.execute("Select RoomNO,Roomtype,Vacancy,Price from
vacancy ")
data=cur.fetchall()
for i in data:
l.append([i[0],i[1],i[2],i[3]])
print(tabulate(l,headers=["Room Number","Room
Type","Status","Price"],tablefmt="pretty"))
def vacantrooms():
l=[]
cur=con.cursor()
cur.execute("Select RoomNO,Vacancy from vacancy where
Vacancy='vacant'")
data=cur.fetchall()
for i in data:
l.append([i[0],i[1]])
print(tabulate(l,headers=["Room
Number","Status"],tablefmt="pretty"))
def occupiedrooms():
l=[]
cur=con.cursor()
cur.execute("Select RoomNO,Vacancy from vacancy where
Vacancy='occupied'")
data=cur.fetchall()
for i in data:
l.append([i[0],i[1]])
print(tabulate(l,headers=["Room
Number","Status"],tablefmt="pretty"))
def Floorwise():
n=int(input("Enter the floor no."))
l=[]
cur=con.cursor()
cur.execute("Select RoomNO,Vacancy from vacancy where
FloorNO=%s",(n,))
data=cur.fetchall()
for i in data:
l.append([i[0],i[1]])
print(tabulate(l,headers=["Room
Number","Status"],tablefmt="pretty"))
def customers():
l=[]
cur=con.cursor()
cur.execute("Select Customer_name,Room_NO from customer")
data=cur.fetchall()
for i in data:
l.append([i[0],i[1]])
print(tabulate(l,headers=["Customer Name","Room
number"],tablefmt="pretty"))
def Duration():
l=[]
cur=con.cursor()
cur.execute("Select Customer_name,Checkin,Checkout from
customer")
data=cur.fetchall()
for i in data:
l.append([i[0],i[1],i[2]])
print(tabulate(l,headers=["Name of Customer","Check in
Date","Check out Date"],tablefmt="pretty"))
def Customerreport():
choice=0
while choice!=4:
print("_________Enter the Choice__________")
print("1. To get the names of customers...")
print("2. To Know the duration till when the room is booked...")
print("3. Back...")
choice=int(input("Enter your choice -"))
if choice==1:
customers()
elif choice==2:
Duration()
elif choice==3:
exit
def Roomreport():
choice=0
while choice!=4:
print("_________Enter the Choice__________")
print("1. To get number of vacant rooms...")
print("2. To get number of occupied rooms...")
print("3. To get the info of rooms floor wise...")
print("4. Back...")
choice=int(input("Enter your choice -"))
if choice==1:
vacantrooms()
elif choice==2:
occupiedrooms()
elif choice==3:
Floorwise()
elif choice==4:
exit
def Reportmenu():
choice=0
while choice!=3:
Roomreport()
elif choice==2:
Customerreport()
elif choice==3:
exit
def Roommenu():
choice=0
while choice!=7:
print("_________Enter the Choice__________")
print("1. To Insert a record in vacancy table...")
print("2. To Update a record in vacancy table...")
print("3. To Delete a record from vacancy table...")
print("4. To Display records of vacancy table...")
print("5. To Insert the required information for booking...")
print("6. To fetch details for booking...")
print("7. Back...")
choice=int(input("Enter your choice -"))
if choice==1:
insertinvacancy()
elif choice==2:
updateroom()
elif choice==3:
deletevacancy()
elif choice==4:
displayvacancy()
elif choice==5:
Roombooking()
elif choice==6:
Enquiry()
elif choice==7:
exit
else:
print("Invalid Choice")
break
def Customermenu():
choice=0
while choice!=4:
if choice==1:
updatecustomer()
elif choice==2:
deletecustomer()
elif choice==3:
displaycustomer()
elif choice==4:
exit
else:
print("Invalid Choice")
break
def mainmenu():
choice=0
while choice!=4:
elif choice==4:
print("......Program Finished......")
exit
else:
print("Invalid Choice")
break
mainmenu()
Output Screens
Home screen
Room Menu
Insert in Vacancy Table
Update status
Update price
Delete record
Display records
Room booking
Enquiry
Customer Menu
Update record
Delete Record
Display records
Report Menu
Room report
Vacant rooms
Occupied rooms
Floor wise
Customer Report
Name of customers
Duration of stay
Testing Technology
Used:-
Black Box Testing
Black-Box testing is a method of software testing
that examines the functionality of an application
based on the specifications. Black Box testing
gives abstraction from code and focuses on testing
effort on the software system behaviour. It is also
known as Specifications based testing.
Independent testing team usually performs this
type of testing during the software testing cycle.
This method of test can be applied to each and
every level of software testing such as unit,
integration, system and acceptance testing.
Websites:-
https://www.w3schools.com/
https://www.tutorialspoint.com/sq
l/sql-update-query.htm
https://www.freecodecamp.org/ne
ws/sql-update-statement-update-
query-in-sql/
Books:-
Computer Science with Python
For class 12th .
Book by: Sumita Arora