READ FIRST!!!! DATA SAVED AT RESERVATION.TXT Please USE FILE MANIPULATION ALL THE DATA WILL BE SAVE TO RESERVATION.TXT Use Python Programming - restaurant reservation program. The application offers different reservation rate for adults and children. (see sample below) RESTAURANT RESERVATION SYSTEM System Menu a. View all Reservations b. Make Reservation c. Delete Reservation d. Generate Report e. Exit 2. When the VIEW RESERVATIONS is clicked, this will display all the reservations made: # Date Time Name Adults Children 1 Nov 10, 2020 10:00 am John Doe 1 1 2 Nov 25, 2020 11:00 am Michelle Franks 2 1 3 Dec 10, 2020 9:00 am Ella Flich 1 1 4 Dec 21, 2020 12:00 pm Dylan Cloze 2 1 3. If the user selects MAKE RESERVATION, the user needs to input the following: a. Name (String) b. Date (String) c. Time (String) d. No of Adults (Integer) e. No of Children (Integer) Note: Adult is 500 per head and Kids is 300 per head reservation, save the data in a text file. 4. If DELETE RESERVATION is selected, the user needs to input the reservation number to remove the existing reservation. 5. If the GENERATE REPORT is clicked, display the report of all reservations:
READ FIRST!!!! DATA SAVED AT RESERVATION.TXT
Please USE FILE MANIPULATION ALL THE DATA WILL BE SAVE TO RESERVATION.TXT
Use Python
RESTAURANT RESERVATION SYSTEM
System Menu
a. View all Reservations
b. Make Reservation
c. Delete Reservation
d. Generate Report
e. Exit
2. When the VIEW RESERVATIONS is clicked, this will display all the reservations made:
# Date Time Name Adults Children 1 Nov 10, 2020 10:00 am John Doe 1 1 2 Nov 25, 2020
11:00 am Michelle Franks 2 1 3 Dec 10, 2020 9:00 am Ella Flich 1 1 4 Dec 21, 2020 12:00 pm
Dylan Cloze 2 1
3. If the user selects MAKE RESERVATION, the user needs to input the following:
a. Name (String)
b. Date (String)
c. Time (String)
d. No of Adults (Integer)
e. No of Children (Integer)
Note: Adult is 500 per head and Kids is 300 per head reservation, save the data in a text file.
4. If DELETE RESERVATION is selected, the user needs to input the reservation number to remove the existing reservation.
5. If the GENERATE REPORT is clicked, display the report of all reservations:
reservation = {}
rnum = 0
while True:
mylist= []
choice = input('\nRESTAURANT RESERVATION SYSTEM\nSystem Menu\na. View all Reservations\nb. Make Reservation\nc. Delete Reservation\nd. Generate Report\ne. Exit\nEnter choice --> ').lower()
f1 = open("reservation.txt", "a")
if(choice == "a"):
if (len(reservation) == 0):
print("There are no reservations!!")
else:
print("#Date\t\t\tTime\t\tName\t\tAdults\t\tChildren")
for item in reservation:
f2 = open("reservation.txt", "r")
print("Records are:")
print(f2.read())
f2.close()
elif(choice =="b"):
try:
rnum += 1
name = input("Enter Name: ")
Date = input("Enter date(DD-MM-YYYY): ")
Time = input("Enter time(HH:MM): ")
adults = input("Number of adults: ")
Children = input("Number os children: ")
f1.write (str(rnum))
f1.write("\t")
f1.write(Date)
f1.write("\t")
f1.write(Time)
f1.write("\t\t")
f1.write(name)
f1.write("\t\t")
f1.write(adults)
f1.write("\t\t")
f1.write(Children)
f1.write("\t")
total = int(adults)*500 + int(Children)*300
reservation[rnum]= [Date,Time,name,adults,Children,total]
f1.write(str(total))
f1.write("\n")
f1.close()
print("\nBelow are your Reservation Details:")
print(
f"Reservation Number\t\t{rnum}\nName\t\t{name}\nDate\t\t{Date}\nTime\t\t\{Time}\nTotal Adults\t\t{adults}\nTotal children\t\t{Children}\n")
print(reservation)
except ValueError:
print("there is an incorrect value!! try again")
elif(choice == "c"):
getindex = 0;
rnumd = int(input("Enter Reservation number:"))
try:
reservation.pop(rnumd)
except KeyError:
print("Invalid reservation ID")
print("Reservation deleted")
elif(choice == "d"):
print("#Date\t\t\tTime\t\tName\t\tAdults\t\tChildren\tSubtotal")
for item in reservation:
for i in reservation.get(item):
print(f"{i}",end="\t\t")
print("\n")
elif(choice == "e"):
break
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images