Will truncate only the line that user inputted Will compute the total number of Adults of all reservation Will compute the tolal number of Children of all reservation and will compute the Grand Total of all reservation 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: 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"): 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(int(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: f1.truncate(rnumd) f1.close() print("No Record found") except KeyError: print("Invalid reservation ID") print("Reservation deleted") elif(choice == "d"): f2 = open("reservation.txt", "r") print("Records are:") print(f2.read()) print("Total Number of Adults: " ) print("Total Number of Children: ") print("Grand Total : ") f2.close() elif(choice == "e"): break

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Will truncate only the line that user inputted
Will compute the total number of Adults of all reservation
Will compute the tolal number of Children of all reservation
and will compute the Grand Total of all reservation

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:



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"):
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(int(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:
f1.truncate(rnumd)
f1.close()
print("No Record found")

except KeyError:
print("Invalid reservation ID")

print("Reservation deleted")

elif(choice == "d"):

f2 = open("reservation.txt", "r")

print("Records are:")
print(f2.read())

print("Total Number of Adults: " )
print("Total Number of Children: ")
print("Grand Total : ")
f2.close()


elif(choice == "e"):
break

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY