import random import datetime name = [] phno = [] add = [] checkin = [] checkout = [] room = [] price = [] p = [] roomno
Posted: Fri Jul 08, 2022 6:34 am
elif ch == 5: print(" ") Delete_Record() else: def date (c): if c[2] >=2022 and c[2] <= 2023: if c[1] != 0 and c[1] <= 12: <= 31: exit() c[0] <= 31: to 7th equal if c[1] == 2 and c[0] != 0 and c[0] if c[2] %4 == 0 and c[0] <= 29: pass elif c[0]<29: pass else: print("Invalid date\n") name.pop(i) phno.pop(i) add.pop(i) checkin.pop(i) checkout.pop(i) Booking() #if month is odd & less than equal # to 7th month elif c[1] <= 7 and c[1] %2 != 0 and pass #if month is even & less than equal #month and not 2nd month elif c[1] <= 7 and c[1] % 2 == 0 and c[0] <= 30 and c[1] != 2: pass #if month is even & greater than
equal c[0]<=30: # if month is odd & greater than # to 8th month elif c[1]>=8 and c[1] %2!= 0 and pass else: else: else: print("Invalid date\n") name.pop(i) phno.pop(i) add.pop(i) checkin.pop(i) checkout.pop(i) Booking ( ) print("Invalid date\n") name.pop(i) phno.pop(i) add.pop(i) checkin.pop(i) checkout.pop(i) Booking ( ) print("Invalid date\n") name.pop(i) phno.pop(i) add.pop(i) checkin.pop(i) checkout.pop(i) Booking ( ) def Booking(): # used global keyword to # use global variable 'i' global i print(" BOOKING ROOMS") print(" ") while 1: n = str(input("Name: ")) ph = int(input ("Phone No.: ")) a = str(input("Address: "))
# checks if any field is not empty if n!="" and ph!="" and a!=""; name.append(n) add.append(a) break else: print("\tName, Phone no. & Address cannot be empty..!!") cii-str(input("Check-In: ")) checkin.append(cii) cii=cii.split('/') ci=cii ci[0]=int (ci[0]) ci[1]=int (ci[1]) ci[2]=int (ci[2]) date (ci) coo=str(input ("Check-Out: ")) checkout.append (coo) coo=coo.split('/') co=c00 co[0]=int (co[0]) co[1]=int (co[1]) co[2]=int (co[2]) # checks if check-out date falls after # check-in date if co[1]=ci [2] and co[0]<=ci [0]: print("\n\tErr..!!\n\tCheck-Out date must fall after Check-In\n") name.pop(i) add.pop(i) checkin.pop(i) checkout.pop(i) Booking ( ) else: pass date (co) d1 = datetime.datetime (ci[2], ci[1], ci [0]) d2 =
datetime.datetime (co[2], co[1], co[0]) d = (d2-d1).days day.append(d) 200" ) print("----SELECT ROOM TYPE----") print(" 1. Standard Non-AC") print(" 2. Standard AC") print(" 3. 3-Bed Non-AC") print(" 4. 3-Bed AC") print(("\t\tPress for Room Prices")) ch=int (input("->")) #if-conditions to display alloted room # type and it's price if ch==0: print(" 1. Standard Non-AC - RM print(" 2. Standard AC- RM 220") print(" 3. 3-Bed Non-AC- RM 250") print(" 4. 3-Bed AC- RM 300") ch=int (input("->")) if ch==1: room.append('Standard Non-AC') print("Room Type- Standard Non-AC") price.append(200) print("Price- 200") elif ch==2: room.append('Standard AC') print("Room Type- Standard AC") price.append(220) print("Price- 220") elif ch==3: room.append('3-Bed Non-AC') print("Room Type- 3-Bed Non-AC") price.append(250) print("Price- 250") elif ch==4: room.append('3-Bed AC') print("Room Type- 3-Bed AC") price.append(300) print("Price- 300") print(" Wrong choice..!!") else:
customer #randomly generating room no. and #id for customer rn = random.randrange (40)+300 cid = random.randrange (40)+10 # checks if alloted room no. & customer #id already not alloted while rn in roomno or cid in custid: rn = random.randrange (60)+300 cid = random.randrange (60)+10 p.append(0) if ph not in phno: phno.append (ph) elif ph in phno: for n in range(0, i): if ph== phno[n]: if p[n]==1: phno.append (ph) elif ph in phno: for n in range(0, i): if ph== phno[n]: if p[n]==0: print("\tPhone no. already exists and payment yet not done..!!") name.pop(i) add.pop(i) checkin.pop(i) checkout.pop(i) Booking ( ) print("") print("\t\t\t***ROOM BOOKED SUCCESSFULLY***\n") print("Room No. - ", In) print("Customer Id - ",cid) roomno.append(rn) custid.append(cid) i=i+1 n=int (input("0-BACK\n ->")) if n==0: Main() else: exit()
def Payment () ph=int (input("Phone Number: ")) global i f=0 for n in range(0, i): if ph==phno[n] : AnCasa") # checks if payment is # not already done if p[n]==0: AnCasa") f=1 print(" Payment") print("
", room[n], "\t\n Room Charges: price[n]*day [n], "\t") 11 print(" Again

for j in range (n+1, i): if ph==phno[j] : if p[j]==0: pass has been Made
