12S ArushiTibrewal CSProject Correct
12S ArushiTibrewal CSProject Correct
SCIENCE BOARD
PROJECT(2020-21)
TOPIC : MOVIE
TICKET BOOKING
SYSTEM
Date:
____________ ___________
Internal External
Examiner Examiner
ACKNOWLEDGEMENT:
I gratefully acknowledge my sincere thanks to my Computer
Science teacher Mr. Anirban Sinha for his valuable assistance,
guidance, overseeing, constructive criticism and suggestions for
this project. I am also indebted to my team members for their
encouragement, help, suggestions, improvements and solutions
for the completion of this project.
1. Schedule table
2. Snacks table
3. Offers Table
4. Drinks Table
5. Directors/actors table
6. Seats tables(5 tables)
i)S1_H02_gunjan
ii)S2_H01_kabir
iii)S2_H02_haami
iv)S3_H01_little
v)S4_H02_atonement
4. Seats_cost table
5. Bill table
PYTHON SOURCE CODE:
import numpy as np
from PIL import Image,ImageFilter
import matplotlib.pyplot as plt
import numpy as np
import mysql.connector as mcon
con=mcon.connect(host='localhost',user='root',password='Aru17112002!')
cur=con.cursor()
cur.execute("create database if not exists movie")
cur.execute("use movie")
password=12345
choice=None
while choice!=0:
print(" If EMPLOYEE press 1.")
print("If CUSTOMER press 2.")
choice=int(input("Enter choice: "))
if choice==1:
password=int(input("Enter passcode: "))
if password!=12345:
print("!!!INCORRECT PASSWORD!!!")
print(" # SYSTEM SHUTTING DOWN # ")
exit()
while password==12345:
print("\n\n\n")
print("0. EXIT")
print("1. VIEW ALL RECORDS")
print("2. UPDATE A RECORD")
print("3. ADD A RECORD")
print("4. SEARCH RECORDS")
print("5. DELETE A RECORD")
print("6. ADD A BOOKING")
c=int(input("Enter choice: "))
if c==1:
print("Enter 1 to see the movie schedule table.")
print("Enter 2 to see the bookings of a movie.")
a=int(input("what do you want to see? ==>"))
if a==1:
query="select * from schedule order by slot_no"
cur.execute(query)
result=cur.fetchall()
print("%15s"%"movie_code","%5s"%"slot_no","%5s"%"day
no","%20s"%"movie name","%15s"%"language","%10s"%"age
rating","%15s"%"duration","%5s"%"Hall_no","%10s"%"start_time")
for row in result:
print("%15s"%row[0],"%5s"%row[1],"%5s"%row[2],"%20s"%row[3],"%15s"%ro
w[4],"%10s"%row[5],"%15s"%row[6],"%5s"%row[7],"%10s"%row[8])
print()
elif a==2:
c1=input("enter the movie code of movie to search for seat bookings:
")
query="select * from {} order by row_no".format(c1)
cur.execute(query)
result=cur.fetchall()
print("%10s"%"seats_left","%5s"%"Row_no.","%10s"%"Type","%10s"%"seats_l
eft","%10s"%"seats_booked")
for row in result:
print("%10s"%row[0],"%5s"%row[1],"%10s"%row[2],"%10s"%row[3],"%10s"%r
ow[4])
print()
elif c==2:
print()
print("1. Update Start time")
print("2. Update duration")
print("3. Update slot number")
print("4. Update hall no")
print("5. Update movie name")
print("6. Update age rating")
print("### YOU ARE NOT PERMITTED TO UPDATE MOVIE CODE
###")
c1=input("enter movie code for the record to be updated: ")
a=int(input("Enter choice : "))
print()
if a==1:
c2=input("enter the new start time: ")
query="update schedule set start_time='{}' where
movie_code='{}'".format(c2,c1)
cur.execute(query)
con.commit()
print(" # UPDATED # ")
print()
elif a==2:
c2=input("Enter the new duration: ")
query="update schedule set duration='{}' where
movie_code='{}'".format(c2,c1)
cur.execute(query)
con.commit()
print(" # UPDATED # ")
print()
elif a==3:
c2=int(input("Enter the new slot number: "))
query="update schedule set slot_no={} where
movie_code='{}'".format(c2,c1)
cur.execute(query)
con.commit()
print(" # UPDATED # ")
print()
elif a==4:
c2=input("Enter the new hall number: ")
query="update schedule set hall_no='{}' where
movie_code='{}'".format(c2,c1)
cur.execute(query)
con.commit()
print(" # UPDATED # ")
print()
elif a==5:
c2=input("Enter the new movie name: ")
query="update schedule set movie_name='{}' where
movie_code='{}'".format(c2,c1)
cur.execute(query)
con.commit()
print(" # UPDATED # ")
print()
elif a==6:
c2=input("Enter the new age rating: ")
query="update schedule set age_rating='{}' where
movie_code='{}'".format(c2,c1)
cur.execute(query)
con.commit()
print(" # UPDATED # ")
print()
elif c==3:
mc=input("enter movie code: ")
sn=int(input("enter slot number: "))
dn=input("enter day number: ")
mn=input("enter movie name: ")
l=input("enter language: ")
ar=input("enter age rating: ")
d=input("enter duration of mive: ")
hn=input("enter hall no. of the movie: ")
st=input("enter the time the movie starts: ")
query="insert into
movie.schedule(movie_code,slot_no,day_no,movie_name,language,age_rating,dur
ation,hall_no,start_time)
values('{}',{},'{}','{}','{}','{}','{}','{}','{}')".format(mc,sn,dn,mn,l,ar,d,hn,st)
cur.execute(query)
con.commit()
print(" ## DATA SAVED ## ")
print()
elif c==4:
a=int(input("Do you want to search by movie_code[1], start_time[2],
movie_name[3], slot_no[4], date[5] or hall_number[6]?\n==>"))
if a==1:
a1=input("enter movie code: ")
query="select
movie_code,Movie_name,Start_time,duration,hall_no,language,age_rating from
schedule where movie code='{}'".format(a1)
cur.execute(query)
result=cur.fetchall()
print("%10s"%"movie_code","%10s"%"Movie_name","%10s"%"start_time","%10
s"%"duration","%10s"%"hall_no","%5s"%"language","%10s"%"age_rating")
for row in result:
print("%10s"%row[0],"%10s"%row[1],"%10s"%row[2],"%10s"%row[3],"%10s"
%row[4],"%10s"%row[5],"%10s"%row[6])
print()
elif a==2:
a1=input("enter start time: ")
query="select
movie_code,Movie_name,Start_time,duration,hall_no,language,age_rating from
schedule where start_time='{}'".format(a1)
cur.execute(query)
result=cur.fetchall()
print("%10s"%"movie_code","%10s"%"Movie_name","%10s"%"start_time","%10
s"%"duration","%10s"%"hall_no","%5s"%"language","%10s"%"age_rating")
for row in result:
print("%10s"%row[0],"%10s"%row[1],"%10s"%row[2],"%10s"%row[3],"%10s"
%row[4],"%10s"%row[5],"%10s"%row[6])
print()
elif a==3:
a1=input("enter movie name: ")
query="select
movie_code,Movie_name,Start_time,duration,hall_no,language,age_rating from
schedule where movie_name like '{}'".format(a1)
cur.execute(query)
result=cur.fetchall()
print("%10s"%"movie_code","%10s"%"Movie_name","%10s"%"start_time","%10
s"%"duration","%10s"%"hall_no","%5s"%"language","%10s"%"age_rating")
for row in result:
print("%10s"%row[0],"%10s"%row[1],"%10s"%row[2],"%10s"%row[3],"%10s"
%row[4],"%10s"%row[5],"%10s"%row[6])
print()
elif a==4:
a1=input("enter slot number: ")
query="select
movie_code,Movie_name,Start_time,duration,hall_no,language,age_rating from
schedule where slot_no={}".format(a1)
cur.execute(query)
result=cur.fetchall()
print("%10s"%"movie_code","%10s"%"Movie_name","%10s"%"start_time","%10
s"%"duration","%10s"%"hall_no","%5s"%"language","%10s"%"age_rating")
for row in result:
print("%10s"%row[0],"%10s"%row[1],"%10s"%row[2],"%10s"%row[3],"%10s"
%row[4],"%10s"%row[5],"%10s"%row[6])
print()
elif a==5:
print("This program is limited to only a certain range of time.")
print("You may enter any date between 2020-12-04 to 2020-12-17")
a1=input("enter date(in YYYY-MM-DD format): ")
d01=['2020-12-04','2020-12-05','2020-12-06','2020-12-07','2020-12-08','2020-12-0
9','2020-12-10']
d02=['2020-12-11','2020-12-12','2020-12-13','2020-12-14','2020-12-15','2020-12-1
6','2020-12-17']
if a1 in d01:
d='D01'
elif a1 in d02:
d="D02"
else:
print("WRONG DATE ENTERED AFTER WARNING")
print(" ## SYSTEM CLOSING ## ")
exit()
query="select
movie_code,Movie_name,Start_time,duration,hall_no,language,age_rating from
schedule where day_no='{}'".format(d)
cur.execute(query)
result=cur.fetchall()
print("%10s"%"movie_code","%10s"%"Movie_name","%10s"%"start_time","%10
s"%"duration","%10s"%"hall_no","%5s"%"language","%10s"%"age_rating")
for row in result:
print("%10s"%row[0],"%10s"%row[1],"%10s"%row[2],"%10s"%row[3],"%10s"
%row[4],"%10s"%row[5],"%10s"%row[6])
print()
elif a==6:
a1=input("enter hall number: ")
query="select
movie_code,Movie_name,Start_time,duration,hall_no,language,age_rating from
schedule where hall_no='{}'".format(a1)
cur.execute(query)
result=cur.fetchall()
print("%10s"%"movie_code","%10s"%"Movie_name","%10s"%"start_time","%10
s"%"duration","%10s"%"hall_no","%5s"%"language","%10s"%"age_rating")
for row in result:
print("%10s"%row[0],"%10s"%row[1],"%10s"%row[2],"%10s"%row[3],"%10s"
%row[4],"%10s"%row[5],"%10s"%row[6])
print()
elif c==5:
a1=input("enter movie code of field to be deleted: ")
query="delete from schedule where movie_code='{}'".format(a1)
cur.execute(query)
con.commit()
query="drop table if exists {}".format(a1)
cur.execute(query)
con.commit()
print("###DELETED###")
print()
elif c==6:
a=input("enter name of movie: ")
query="select
movie_code,movie_name,start_time,duration,hall_no,language,age_rating from
schedule where movie_name='{}'".format(a)
cur.execute(query)
result=cur.fetchall()
print("%10s"%"movie_code","%10s"%"Movie_name","%10s"%"start_time","%10
s"%"duration","%10s"%"hall_no","%5s"%"language","%10s"%"age_rating")
for row in result:
print("%10s"%row[0],"%10s"%row[1],"%10s"%row[2],"%10s"%row[3],"%10s"
%row[4],"%10s"%row[5],"%10s"%row[6])
print()
m=input("enter movie code of the date at the movie that has to be
booked: ")
query="select * from {} order by row_no".format(m)
cur.execute(query)
result=cur.fetchall()
print("%15s"%"total_available","%10s"%"Row_number","%10s"%"type","%10s"
%"seats_open","%10s"%"seats_booked")
for row in result:
print("%15s"%row[0],"%10s"%row[1],"%10s"%row[2],"%10s"%row[3],"%10s"
%row[4])
print()
c1=int(input("To book single ticket press 1. To book multiple press
2.\n==>"))
if c1==1:
r=int(input("Enter row number: "))
print()
print("Please be careful to enter only seat numbers available,
otherwise system may crash.")
print()
s=int(input("enter seat number: "))
l="select seat_nos_avail from {} where row_no={}".format(m,r)
cur.execute(l)
l1=cur.fetchall()
if l1[0][0]=='null':
print("### INVALID SEAT NUMBER ###")
print("### CLOSING SYSTEM ###")
exit()
l3="select seat_nos_booked from {} where row_no={}".format(m,r)
cur.execute(l3)
l4=cur.fetchall()
l2=[]
l5=[]
for i in l1[0][0].split(','):
if i!=str(s):
l2.append(i)
s1=""
for i in range(len(l2)):
s1+=l2[i]+','
for i in l4[0][0].split(','):
l5.append(i)
l5.append(str(s))
s2=""
for i in range(len(l5)):
s2+=l5[i]+','
query="update {} set seat_nos_avail='{}' where
row_no={}".format(m,s1,r)
cur.execute(query)
con.commit()
query="update {} set seat_nos_booked='{}' where
row_no={}".format(m,s2,r)
cur.execute(query)
con.commit()
query="update {} set total_available=total_available-1 where
row_no={}".format(m,r)
cur.execute(query)
con.commit()
elif c1==2:
r=int(input("enter row number: "))
n=int(input("enter number of tickets to book: "))
print()
print("Please be careful to enter only seat numbers available,
otherwise system may crash.")
print()
s=input("enter seats numbers(give with commas): ")
l="select seat_nos_avail from {} where row_no={}".format(m,r)
cur.execute(l)
l1=cur.fetchall()
if l1[0][0]=='null':
print("### INVALID SEAT NUMBER ###")
print("### CLOSING SYSTEM ###")
exit()
l3="select seat_nos_booked from {} where row_no={}".format(m,r)
cur.execute(l3)
l4=cur.fetchall()
l2=[]
l5=[]
for i in l1[0][0].split(','):
if i not in str(s):
l2.append(i)
s1=""
for i in range(len(l2)):
s1+=l2[i]+','
for i in l4[0][0].split(','):
l5.append(i)
l5.append(str(s))
s2=""
for i in range(len(l5)):
s2+=l5[i]+','
query="update {} set seat_nos_avail='{}' where
row_no={}".format(m,s1,r)
cur.execute(query)
con.commit()
query="update {} set seat_nos_booked='{}' where
row_no={}".format(m,s2,r)
cur.execute(query)
con.commit()
query="update {} set total_available=total_available-{} where
row_no={}".format(m,n,r)
cur.execute(query)
con.commit()
elif c==0:
print(" # EXIT # ")
break
break
while choice==2:
print("\n\n\n")
print("0. EXIT")
print("1. SEARCH (BY MOVIE NAME, TIMING OR DATE)")
print("2. VIEW SEATING ARRANGEMENT OF HALL.")
print("3. VIEW SEAT TYPE AND COST OF SEAT")
print("4. VIEW MENU FOR SNACKS")
print("5. VIEW SPECIAL OFFERS AND COMBOS")
print("6. VIEW THE DRINKS MENU")
print("7. DELETE A PREVIOUS BOOKING")
print("8. FILL FEEDBACK FORM")
print("9. BOOK ITEMS AND VIEW BILL(+COUPON FOR SNACKS)")
print("10. PLEASE VIEW THE SAFETY REGULATIONS TO BE
FOLLOWED!!!")
print("TO EXIT PRESS 0")
print("\n** Please see placement of row before booking a ticket **")
print("\n** Please read the safety guidelines before exiting **")
c=int(input("Enter choice: "))
cur.execute("create table if not exists movie.bill(item_name varchar(50),cost
int(3))")
con.commit()
if c==1:
print("0. Search all movies available")
print("1. Search by Movie name.")
print("2. Search by date.")
print("3. search by poster.")
print("4. Search by start time.")
print("5. Search by director name.")
print("6. Search by actor name.")
print("7. Search by actress name.")
c1=int(input("Enter choice: "))
if c1==0:
query="select
movie_name,slot_no,Language,age_rating,duration,hall_no,start_time from
schedule order by slot_no"
cur.execute(query)
result=cur.fetchall()
print("%20s"%"movie
name","%5s"%"slot_no","%15s"%"language","%10s"%"age
rating","%15s"%"duration","%5s"%"Hall_no","%10s"%"start_time")
for row in result:
print("%20s"%row[0],"%5s"%row[1],"%15s"%row[2],"%10s"%row[3],"%15s"%r
ow[4],"%5s"%row[5],"%10s"%row[6])
print()
elif c1==1:
n=input("enter the name of the movie: ")
query="select
movie_name,language,age_rating,start_time,duration,hall_no from schedule where
movie_name like '{}'".format(n)
cur.execute(query)
result = cur.fetchall()
if cur.rowcount==0:
print("No such movie playing.")
else:
print("%10s"%"movie_name",
"%10s"%"language","%10s"%"age_rating",
"%10s"%"start_time","%10s"%"duration","%10s"%"hall_no")
for row in result:
print("%10s"%row[0],"%10s"%row[1],"%10s"%row[2],
"%10s"%row[3],"%10s"%row[4], "%10s"%row[5])
print()
elif c1==2:
print("This program is limited to only a certain range of time.")
print("You may enter any date between 2020-12-04 to 2020-12-17")
a1=input("enter date(in YYYY-MM-DD format): ")
d01=['2020-12-04','2020-12-05','2020-12-06','2020-12-07','2020-12-08','2020-12-0
9','2020-12-10']
d02=['2020-12-11','2020-12-12','2020-12-13','2020-12-14','2020-12-15','2020-12-1
6','2020-12-17']
if a1 in d01:
d='D01'
elif a1 in d02:
d="D02"
else:
print("WRONG DATE ENTERED AFTER WARNING")
print(" ## SYSTEM CLOSING ## ")
exit()
query="select
movie_name,language,age_rating,start_time,duration,hall_no from schedule where
day_no='{}'".format(d)
cur.execute(query)
result=cur.fetchall()
print("%10s"%"Movie_name","%10s"%"language","%10s"%"Age_Rating","%10s
"%"Start_time","%10s"%"duration","%10s"%"hall number")
for row in result:
print("%10s"%row[0],"%10s"%row[1],"%10s"%row[2],"%10s"%row[3],"%10s"
%row[4],"%10s"%row[5])
print()
elif c1==3:
im1 =
(Image.open('/users/arushi/desktop/posters/gunjan.jpg').resize((225,225)))
im2 =
(Image.open('/users/arushi/desktop/posters/little.jpg').resize((225,225)))
im3 =
(Image.open('/users/arushi/desktop/posters/haami.jpg').resize((225,225)))
im4 =
(Image.open('/users/arushi/desktop/posters/atonement.jpg').resize((225,225)))
im5 =
(Image.open('/users/arushi/desktop/posters/kabir.jpg').resize((225,225)))
from IPython.core.display import Image, display
display(im1)
print("Gunjan Saxena: The Kargil Girl")
print()
display(im2)
print("Little Women")
print()
display(im3)
print("Haami")
print()
display(im4)
print("Atonement")
print()
display(im5)
print("Kabir Singh")
print()
elif c1==4:
t=input("enter the starting time of the movie: ")
query="select
movie_name,language,age_rating,start_time,duration,hall_no from schedule where
start_time like '{}'".format(t)
cur.execute(query)
result = cur.fetchall()
if cur.rowcount==0:
print("No such movie playing at this time.")
else:
print("%10s"%"movie_name",
"%20s"%"language","%10s"%"age_rating",
"%10s"%"age_rating","%10s"%"duration","%10s"%"hall_no")
for row in result:
print("%10s"%row[0],"%20s"%row[1],"%10s"%row[2],
"%10s"%row[3],"%10s"%row[4], "%10s"%row[5])
elif c1==5:
t=input("enter name of the director : ")
query = "select movie_name,director from directors where director like
'{}'".format(t)
cur.execute(query)
result=cur.fetchall()
if cur.rowcount == 0:
print("No Movie Available with this director.")
else:
print("%20s" % "movie_name", "%20s" % "director")
for row in result:
print("%20s"%row[0],"%20s"%row[1])
elif c1==6:
t=input("enter name of the lead actor : ")
query = "select movie_name,actor from directors where actor like
'{}'".format(t)
cur.execute(query)
result = cur.fetchall()
if cur.rowcount == 0:
print("No Movie Available with this actor.")
else:
print("%20s"% "movie_name","%20s"%"Lead Actor")
for row in result:
print("%20s"%row[0],"%20s"%row[1])
elif c1==7:
tttt = input("enter name of the lead actress : ")
query = "select movie_name,actress from directors where actress like
'{}'".format(
tttt)
cur.execute(query)
result = cur.fetchall()
if cur.rowcount == 0:
print("No such Movie Available with this Actress")
else:
print("%20s"%"Movie_name","%25s"%"Lead Actress")
for row in result:
print("%20s"%row[0],"%25s"%row[1])
elif c==2:
x=np.arange(0,11)
print(x)
y=8*x/x
y1=5*x/x
y2=4*x/x
y3=3*x/x
y4=2*x/x
y5=x/x
plt.xlabel('x - axis')
plt.ylabel('y - axis')
plt.plot(x,y,'b')
plt.plot(x,y1,'r',marker=".",markersize=20)
plt.plot(x,y2,'r',marker=".",markersize=20)
plt.plot(x,y3,'r',marker=".",markersize=20)
plt.plot(x,y4,'r',marker=".",markersize=20)
plt.plot(x,y5,'y',marker=".",markersize=20)
plt.show()
elif c==3:
query="select * from seats"
cur.execute(query)
result=cur.fetchall()
print("%10s"%"Seat type","%10s"%"Cost")
for row in result:
print("%10s"%row[0],"%10s"%row[1])
print()
elif c==4:
query="select * from snacks order by s_no"
cur.execute(query)
result=cur.fetchall()
print("%10s"%"S_no.","%20s"%"Item name","%10s"%"cost")
for row in result:
print("%10s"%row[0],"%20s"%row[1],"%10s"%row[2])
print("You will recieve a coupon for confirmation of booking")
print("If you do not receive the coupon, please contact 9XXXX XXXXX")
print()
elif c==5:
query="select * from offers"
cur.execute(query)
result=cur.fetchall()
print("%10s"%"S_no.","%30s"%"Combos","%10s"%"cost")
for row in result:
print("%10s"%row[0],"%30s"%row[1],"%10s"%row[2])
print("You will recieve a coupon for confirmation of booking")
print("If you do not receive the coupn, please contact 9XXXX XXXXX")
print()
elif c==6:
query="select * from drinks"
cur.execute(query)
result=cur.fetchall()
print("%10s"%"S_no.","%20s"%"Item name","%10s"%"cost")
for row in result:
print("%10s"%row[0],"%20s"%row[1],"%10s"%row[2])
print("You will recieve a coupon for confirmation of booking")
print("If you do not receive the coupn, please contact 9XXXX XXXXX")
print()
elif c==7:
ans=input("do you want to delete seat number booking?(y/n) \n==>")
if ans=='y':
a=input("enter name of movie: ")
query="select
movie_code,movie_name,start_time,duration,hall_no,language,age_rating from
schedule where movie_name='{}'".format(a)
cur.execute(query)
result=cur.fetchall()
print("%10s"%"movie_code","%10s"%"Movie_name","%10s"%"start_time","%10
s"%"duration","%10s"%"hall_no","%10s"%"language","%10s"%"age_rating")
for row in result:
print("%10s"%row[0],"%10s"%row[1],"%10s"%row[2],"%10s"%row[3],"%10s"
%row[4],"%10s"%row[5],"%10s"%row[6])
print()
m=input("enter movie code of the date at the movie that has to be deleted
or updated: ")
query="select * from {} order by row_no".format(m)
cur.execute(query)
result=cur.fetchall()
print("%15s"%"total_available","%10s"%"Row_number","%10s"%"type","%10s"
%"seats_open","%10s"%"seats_booked")
for row in result:
print("%15s"%row[0],"%10s"%row[1],"%10s"%row[2],"%10s"%row[3],"%10s"
%row[4])
print()
c1=int(input("If you had booked single ticket press 1; If you booked
multiple tickets press 2.\n==>"))
if c1==1:
r=int(input("Enter row number: "))
print()
print("Please be careful to enter only seat numbers booked, otherwise
system may crash.")
print()
s=int(input("enter seat number: "))
l="select seat_nos_avail from {} where row_no={}".format(m,r)
cur.execute(l)
l1=cur.fetchall()
l3="select seat_nos_booked from {} where row_no={}".format(m,r)
cur.execute(l3)
l4=cur.fetchall()
if l4[0][0]=='null':
print("### INVALID SEAT NUMBER ###")
print("### CLOSING SYSTEM ###")
exit()
l2=[]
l5=[]
for i in l1[0][0].split(','):
l2.append(i)
l2.append(str(s))
s1=""
for i in range(len(l2)):
s1+=l2[i]+','
for i in l4[0][0].split(','):
if i!=str(s):
l5.append(i)
s2=""
for i in range(len(l5)):
s2+=l5[i]+','
query="update {} set seat_nos_avail='{}' where
row_no={}".format(m,s1,r)
cur.execute(query)
con.commit()
query="update {} set seat_nos_booked='{}' where
row_no={}".format(m,s2,r)
cur.execute(query)
con.commit()
query="update {} set total_available=total_available+1 where
row_no={}".format(m,r)
cur.execute(query)
con.commit()
elif c1==2:
r=int(input("enter row number: "))
n=int(input("enter number of tickets to book: "))
print()
print("Please be careful to enter only seat numbers available,
otherwise system may crash.")
print()
s=input("enter seats numbers(give with commas): ")
l="select seat_nos_avail from {} where row_no={}".format(m,r)
cur.execute(l)
l1=cur.fetchall()
l3="select seat_nos_booked from {} where row_no={}".format(m,r)
cur.execute(l3)
l4=cur.fetchall()
if l4[0][0]=='null':
print("### INVALID SEAT NUMBER ###")
print("### CLOSING SYSTEM ###")
exit()
l2=[]
l5=[]
for i in l1[0][0].split(','):
l2.append(i)
l2.append(str(s))
s1=""
for i in range(len(l2)):
s1+=l2[i]+','
for i in l4[0][0].split(','):
if i not in str(s):
l5.append(i)
s2=""
for i in range(len(l5)):
s2+=l5[i]+','
query="update {} set seat_nos_avail='{}' where
row_no={}".format(m,s1,r)
cur.execute(query)
con.commit()
query="update {} set seat_nos_booked='{}' where
row_no={}".format(m,s2,r)
cur.execute(query)
con.commit()
query="update {} set total_available=total_available+{} where
row_no={}".format(m,n,r)
cur.execute(query)
con.commit()
elif c==8:
print("Please give answers as 1,2,3")
print("1.satisfactory")
print("2.good")
print("3.excellent")
q1=int(input("How were the safety measures adopted for your
safety?\n==>"))
q2=int(input("How was the food quality?\n==>"))
q3=int(input("Please rate your experience?\n==>"))
elif c==9:
print("Due to safety regulations hall can only be filled to half capacity.")
print("Only seat numbers 1,3,5,7,9 are available.")
print("We are sorry for the inconvenience.")
name=input("Please enter name under which booking is to be done: ")
phone=input("Please enter your contact number, as text message will be
sent for confirmation: ")
a=input("enter name of movie: ")
query="select
movie_code,movie_name,start_time,duration,hall_no,language,age_rating from
schedule where movie_name='{}'".format(a)
cur.execute(query)
result=cur.fetchall()
print("%10s"%"movie_code","%10s"%"Movie_name","%10s"%"start_time","%10
s"%"duration","%10s"%"hall_no","%10s"%"language","%10s"%"age_rating")
for row in result:
print("%10s"%row[0],"%10s"%row[1],"%10s"%row[2],"%10s"%row[3],"%10s"
%row[4],"%10s"%row[5],"%10s"%row[6])
print()
m=input("enter movie code of the day at which you want to see the movie:
")
query="select * from {}".format(m)
cur.execute(query)
result=cur.fetchall()
print("%15s"%"total_available","%10s"%"Row_number","%10s"%"type","%10s"
%"seats_open","%10s"%"seats_booked")
for row in result:
print("%15s"%row[0],"%10s"%row[1],"%10s"%row[2],"%10s"%row[3],"%10s"
%row[4])
print()
c1=int(input("To book single ticket press 1. To book multiple press
2.\n==>"))
if c1==1:
r=int(input("Enter row number: "))
print()
print("Please be careful to enter only seat numbers available, otherwise
system may crash.")
print()
s=int(input("enter seat number: "))
l="select seat_nos_avail from {} where row_no={}".format(m,r)
cur.execute(l)
l1=cur.fetchall()
if l1[0][0]=='null':
print("### INVALID SEAT NUMBER ###")
print("### CLOSING SYSTEM ###")
exit()
l3="select seat_nos_booked from {} where row_no={}".format(m,r)
cur.execute(l3)
l4=cur.fetchall()
l2=[]
l5=[]
for i in l1[0][0].split(','):
if i!=str(s):
l2.append(i)
s1=""
for i in range(len(l2)):
s1+=l2[i]+','
for i in l4[0][0].split(','):
l5.append(i)
l5.append(str(s))
s2=""
for i in range(len(l5)):
s2+=l5[i]+','
query="update {} set seat_nos_avail='{}' where
row_no={}".format(m,s1,r)
cur.execute(query)
con.commit()
query="update {} set seat_nos_booked='{}' where
row_no={}".format(m,s2,r)
cur.execute(query)
con.commit()
query="update {} set total_available=total_available-1 where
row_no={}".format(m,r)
cur.execute(query)
con.commit()
elif c1==2:
r=int(input("enter row number: "))
n=int(input("enter number of tickets to book: "))
print()
print("Please be careful to enter only seat numbers available, otherwise
system may crash.")
print()
s=input("enter seats numbers(give with commas): ")
l="select seat_nos_avail from {} where row_no={}".format(m,r)
cur.execute(l)
l1=cur.fetchall()
if l1[0][0]=='null':
print("### INVALID SEAT NUMBER ###")
print("### CLOSING SYSTEM ###")
exit()
l3="select seat_nos_booked from {} where row_no={}".format(m,r)
cur.execute(l3)
l4=cur.fetchall()
l2=[]
l5=[]
for i in l1[0][0].split(','):
if i not in str(s):
l2.append(i)
s1=""
for i in range(len(l2)):
s1+=l2[i]+','
for i in l4[0][0].split(','):
l5.append(i)
l5.append(str(s))
s2=""
for i in range(len(l5)):
s2+=l5[i]+','
query="update {} set seat_nos_avail='{}' where
row_no={}".format(m,s1,r)
cur.execute(query)
con.commit()
query="update {} set seat_nos_booked='{}' where
row_no={}".format(m,s2,r)
cur.execute(query)
con.commit()
query="update {} set total_available=total_available-{} where
row_no={}".format(m,n,r)
cur.execute(query)
con.commit()
if r==1:
s1='Gold'+'('+str(c1)+')'
cost=200*c1
elif r==2 or r==3 or r==4 or r==5:
s1='Regular'+'('+str(c1)+')'
cost=50*c1
cur.execute("insert into bill values('SEAT',{})".format(cost))
con.commit()
c1=input("Enter seat number/s booked. \n==>")
if c1 in "2,4,6,8":
print("### INVALID SEAT NUMBER!!! EXITING ###")
exit()
snacks=[[1,'Chips',30],[2,'Popcorn(Medium)',100],[3,'Popcorn(Large)',150],[4,'Che
ese popcorn(medium)',120],[5,'Cheese
popcorn(large)',140],[6,'Sandwitch',20],[7,'Ice-cream',85],[8,'Nachos',80],[9,'Caram
el popcorn(medium) ',120],[10,'Caramel popcorn(large)',140]]
offers=[[1,'chips+coca cola',65],[2,'Cheese
Popcorn(med.)+pepsi(large)',140],[3,'Cheese
Popcorn(large)+pepsi(med.)',150],[4,'Caramel
Popcorn(med.)+pepsi(large)',140],[5,'Caramel
Popcorn(large)+pepsi(med.)',150],[6,'Nachos+coca cola',120],[7,'Sandwitch+cold
coffee',60]]
drinks=[[1,'Water',30],[2,'Hot coffee',50],[3,' Cold
coffee',55],[4,'Pepsi(medium)',40],[5,'Pepsi(large)',60],[6,'Fanta(medium)',40],[7,'F
anta(large)',60],[8,'Diet
Coke',50],[9,'Coca-Cola',55],[10,'Sprite(medium)',140],[11,'Sprite(large)',60],[12,'
Tea',30]]
print()
for i in range(len(snacks)):
print(*snacks[i])
s=input("Want to book snacks?(y/n)\n==>")
print("\n")
if s.lower()=='y':
b1=int(input("Enter s.no. of snacks you want to book: "))
bill1=snacks[b1-1][2]
cur.execute("insert into bill
values('SNACKS',{})".format(snacks[b1-1][2]))
con.commit()
s=input("Do you want to book more?(y/n)\n==>")
print()
print()
else:
bill1=0
for i in range(len(offers)):
print(*offers[i])
print("\n")
s=input("Do you want to book combos?(y/n)\n==>")
if s.lower()=='y':
b2=int(input("Enter s.no. of combos you want to book: "))
bill2=offers[b2-1][2]
cur.execute("insert into bill
values('OFFERS',{})".format(offers[b2-1][2]))
con.commit()
s=input("Do you want to book more?(y/n)\n==>")
print()
print()
else:
bill2=0
for i in range(len(drinks)):
print(*drinks[i])
print("\n")
s=input("Do you want to book drinks?(y/n)\n==>")
if s.lower()=='y':
b3=int(input("Enter s.no. of drinks you want to book: "))
bill3=drinks[b3-1][2]
cur.execute("insert into bill
values('DRINKS',{})".format(drinks[b3-1][2]))
con.commit()
s=input("Do you want to book more?(y/n)\n==>")
print()
print()
else:
bill3=0
print()
print("Your bill is:- ")
print('\n'+ a.upper())
print("Name: ",name)
print("Contact no.: ",phone)
print('\n'+"Seat type: ",s1,"; Cost: ",cost)
print("Your seat number/s are: ",c1)
print()
print()
query="select * from bill"
cur.execute(query)
result=cur.fetchall()
print("%10s"%"Item","%10s"%"Cost")
for row in result:
print("%10s"%row[0],"%10s"%row[1])
print("Your total is: ")
print()
total=bill1+bill2+bill3+cost
print(total)
print()
print()
print("Please take a screenshot or print out of the bill as coupon.")
print("You may use the computer screens at the mall to print tickets as well,
but do so at your own risk")
print("Have a nice day!")
elif c==10:
print("#General guidelines#\n* Theatre operators to promote advance
booking and keep counters open the whole day.")
print("\n* Frequent visits outside the hall during intermission/break should
be avoided by customers.")
print("\n* Use of the Aarogya Setu app advised in the guidelines.")
print( "\n* Government has also advised in favour of cashless transactions")
print( "\n* No spitting will be allowed outside or inside the premises of the
cinema halls.")
print("\n* The cinema halls are to function on only half of their seating
capacity.")
print("\n* One seat will be kept vacant between two persons in the cinema
hall")
print( "\n* Cinema halls will keep the temperature of the hall fixed at 23
degree celsius.")
print("\n* Proper ventilation in the hall is mandated to avoid the spread of
the infection.")
print( "\n* In order to avoid crowding at the end of the show, shows will be
timed in a staggered manner.")
print( "\n* Adequate number of ticket counters to avoid crowding at the
counters.")
print("\n\n#Guidelines for Theatre Entry#")
print("\n* Mandatory thermal screening at the entry gates.")
print("\n* Only asymptomatic individuals will be let inside the theatre.")
print("\n* All the people will have to keep their face mask on throughout
the entire duration of the film.")
print("THANK YOU FOR YOUR COOPERATION.")
elif c==0:
print(" ### Exit ### ")
choice=0
OUTPUT:
1. Intializing as an Employee
Original:
Updated:
4. Searching Records
Adding:
Deleting:
6. Adding a booking as employee
7. Exiting as Employee
8. Entering as Customer
9. Searching as Customer
* (Some last edits were done and options 7 and 10 were merged. Please
disregard option 7 through the course of the program output screenshots.) *
BIBLIOGRAPHY:
● COMPUTER SCIENCE WITH PYTHON CLASS-XII BY
Sumita Arora
● https://dev.mysql.com/downloads/connector/python/
● www.google.com
● www.geeksforgeeks.org
● www.stackoverflow.com