import random import datetime name = [] phno = [] add = [] checkin = [] checkout = [] room = [] price = [] p = [] roomno

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

import random import datetime name = [] phno = [] add = [] checkin = [] checkout = [] room = [] price = [] p = [] roomno

Post by answerhappygod »

Import Random Import Datetime Name Phno Add Checkin Checkout Room Price P Roomno 1
Import Random Import Datetime Name Phno Add Checkin Checkout Room Price P Roomno 1 (29.34 KiB) Viewed 33 times
Import Random Import Datetime Name Phno Add Checkin Checkout Room Price P Roomno 2
Import Random Import Datetime Name Phno Add Checkin Checkout Room Price P Roomno 2 (32.1 KiB) Viewed 33 times
Import Random Import Datetime Name Phno Add Checkin Checkout Room Price P Roomno 3
Import Random Import Datetime Name Phno Add Checkin Checkout Room Price P Roomno 3 (32.53 KiB) Viewed 33 times
Import Random Import Datetime Name Phno Add Checkin Checkout Room Price P Roomno 4
Import Random Import Datetime Name Phno Add Checkin Checkout Room Price P Roomno 4 (48.48 KiB) Viewed 33 times
Import Random Import Datetime Name Phno Add Checkin Checkout Room Price P Roomno 5
Import Random Import Datetime Name Phno Add Checkin Checkout Room Price P Roomno 5 (51.83 KiB) Viewed 33 times
Import Random Import Datetime Name Phno Add Checkin Checkout Room Price P Roomno 6
Import Random Import Datetime Name Phno Add Checkin Checkout Room Price P Roomno 6 (51.21 KiB) Viewed 33 times
Import Random Import Datetime Name Phno Add Checkin Checkout Room Price P Roomno 7
Import Random Import Datetime Name Phno Add Checkin Checkout Room Price P Roomno 7 (41.02 KiB) Viewed 33 times
Import Random Import Datetime Name Phno Add Checkin Checkout Room Price P Roomno 8
Import Random Import Datetime Name Phno Add Checkin Checkout Room Price P Roomno 8 (39.08 KiB) Viewed 33 times
Import Random Import Datetime Name Phno Add Checkin Checkout Room Price P Roomno 9
Import Random Import Datetime Name Phno Add Checkin Checkout Room Price P Roomno 9 (51.85 KiB) Viewed 33 times
Import Random Import Datetime Name Phno Add Checkin Checkout Room Price P Roomno 10
Import Random Import Datetime Name Phno Add Checkin Checkout Room Price P Roomno 10 (46.63 KiB) Viewed 33 times
import random import datetime name = [] phno = [] add = [] checkin = [] checkout = [] room = [] price = [] p = [] roomno = [] custid = [] day = [] i = 0 def Main(): print("\t\t\t\t\t\t WELCOME TO HOTEL print("\t\t\t 1 Booking\n") print("\t\t\t 2 Payment\n") print("\t\t\t 3 Record\n") print("\t\t\t 4 Search Record\n") print("\t\t\t ANCASA\n") 5 Delete Record\n") print("\t\t\t 0 Exit\n") ch=int (input("->")) if ch == 1: print(" ") Booking() elif ch == 2: print(" ") Payment () elif ch == 3: print(" ") Record() elif ch == 4: print(" ") Search()
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(" ➖➖➖➖") print(" MODE OF PAYMENT") print(" 1- Credit/Debit Card") print(" 2- Paytm/PhonePe") print(" 3- Using UPI") print(" 4- Cash") (price[n]*day[n])) x=int (input("-> ")) print("\n Amount: ", print("\n print(" (y/n)") ch=str(input("->")) if ch=='y' or ch=='Y': print("\n\n print(" print(" print(" print(" -") Pay For Hotel ", checkin[n], "\t\n Check-Out: "checkout[n], "\t") print(" Name: ", name[n], "\t\n Phone No.: ", phno[n], "\t\n Address: ", add[n], "\t") print("\n Check-In: Bill")
", room[n], "\t\n Room Charges: price[n]*day [n], "\t") 11 print(" Again :)") (price[n]*day [n]), "\t") id from list and print("\n Room Type: position else: -") print("\n Total Amount: print(" --") print(" print(" print(" p.pop(n) p.insert(n,1) --\n") Thank You") Visit #pops room no. and customer # later assigns zero at same roomno.pop(n) custid.pop(n) roomno.insert(n,0) custid.insert(n, 0)
for j in range (n+1, i): if ph==phno[j] : if p[j]==0: pass has been Made :)\n\n") if f == 0: else: else: f=1 print("\n\tPayment print("Invalid Customer Id") n = int(input("0-BACK\n ->")) if n == 0: Main() exit() def Record (): # checks if any record exists or not if phno! = []: print(" print("| Name | Check-In | Check-Out | Price [") *** HOTEL RECORD ***\n") | Phone No. | Address Room Type for n in range (0, i): print("|", name[n], "\t\ |", phno[n], "\t", add[n], "\t|", checkin[n], "\t", c heckout[n], "\t", room[n], "\t\",price[n])
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply