1. Other
  2. Other
  3. hi im working on an assignment that requires me to...

Question: hi im working on an assignment that requires me to...

Question details

Hi, I'm working on an assignment that requires me to code a ticketing system.

There are supposed to be 5 operating systems; n for a new transaction, e to edit the earlier transaction, f to finish the transaction and print receipt, p to print available seatings, and q to quit.

These are my questions:

1. How do I code such that the system will ask "Please enter your system operations:" after the user finishes a system operation?

2. How do I code such that when the user enters his data in 'new transaction', the system will record that data, and the user will be able to edit that data when he enters 'e'?

3. How do I do the same as above for the 'finish transaction' option?

4. How do I allow the user to quit the system?

Thanks!

Here is my code:

#Introduction Paragraph

introduction = "Welcome to the 'Puppet Show for Kids' ticket system. The show will be here for two days only, Wednesday and Saturday."

pricing = '\nFares: \n \tAdult ticket:     $50.00(including GST) \n \tChild ticket:      $70.00(including GST) \n \tSenior(Aged 60 and above) ticket:      $30.00(including GST)'

discounts = "\nDiscount available: \n \tFamily Combo:      20% off \n (2 adults and 2 children, excluding seniors) \n Weekday show:      10% off \n Available seats: \n Wednesday:      30 \n Saturday:       30"

para = introduction + pricing + discounts

Children = 0

Adults = 0

Seniors = 0

print(88*"=")

print(para)

print(88*"=")

print("n: new transaction, f: finish transaction, p: print vacancy, q: quit")

selection = str(input("Enter your system operations please: "))

print(selection)

 

#System Operation "n"

while True:

    while True:  

           

      if selection == "n":

          Children = int(input("No. of Children: "))

          Adults = int(input("No. of Adults: "))

          Seniors = int(input("No. of Seniors: "))

          Family = (Children + Adults)//4

          print("No. of Family Combos: ", Family ,)

          Date = input(str("Date of Show(0: Saturday, 1: Wednesday): "))

          Edit = str(input("Would you like to edit your transaction?(Y: Edit, N: Ignore): "))

          

          if Edit == "Y":

              selection == "n"

                   

          elif Edit == "N":

              selection == "f"

              

          else:

              break

          

#System Operation "p"          

      elif selection == "p":

    

           Children = int(input("No. of Children: "))

           Adults = int(input("No. of Adults: "))

           Seniors = int(input("No. of Seniors: "))    

    

           vacancy_sat = 30

           vacancy_wed = 30

           

           user = 1

           for i in range(user):

               

               seats_taken_wed = Children + Adults + Seniors

               seats_taken_sat = Children + Adults + Seniors

               vacancy_sat = vacancy_sat - seats_taken_sat

               vacancy_wed = vacancy_wed - seats_taken_wed

               print("Available seats for Saturday:", vacancy_sat ,)

               print("Available seats for Wednesday:", vacancy_wed ,)

               

#System Operation "q"

      elif selection == "q":

         print("Thank you for using our ticketing system. Goodbye!")

               

#System Operation "f"               

      elif selection == "f":

          

          Children = int(input("No. of Children: "))

          Adults = int(input("No. of Adults: "))

          Seniors = int(input("No. of Seniors: "))

          Family = (Children + Adults)//4

          print("No. of Family Combos: ", Family ,)

          Date = input(str("Date of Show(0: Saturday, 1: Wednesday): "))

          

          #If user chooses Wednesday show

          if Date == 1:

              c_ticketprice = Children*70

              a_ticketprice = Adults*50

              s_ticketprice = Seniors*30

              fc_ticketprice = 0.8*(2*50 + 2*70)*Family

              total_ticketprice_fc = s_ticketprice + fc_ticketprice

              total_ticketprice_wfc = c_ticketprice + a_ticketprice + s_ticketprice

              wkday_disc_fc = 0.1*total_ticketprice_fc

              wkday_disc_wfc = 0.1*total_ticketprice_wfc

              seats_taken = Children + Adults + Seniors

              gst_fc = 0.07*total_ticketprice_fc

              gst_wfc = 0.07*total_ticketprice_fc

              grand_total_fc = total_ticketprice_fc + gst_fc

              grand_total_wfc = total_ticketprice_wfc + gst_wfc

              Family = (Children + Adults)//4

              

          #If user chooses Wednesday show and Family Combo criteria met     

          if Children and Adults >= 2:

              c_ticketprice = Children*70

              a_ticketprice = Adults*50

              s_ticketprice = Seniors*30

              fc_ticketprice = 0.8*(2*50 + 2*70)*Family

              total_ticketprice_fc = s_ticketprice + fc_ticketprice

              total_ticketprice_wfc = c_ticketprice + a_ticketprice + s_ticketprice

              wkday_disc_fc = 0.1*total_ticketprice_fc

              wkday_disc_wfc = 0.1*total_ticketprice_wfc

              seats_taken = Children + Adults + Seniors

              gst_fc = 0.07*total_ticketprice_fc

              gst_wfc = 0.07*total_ticketprice_fc

              grand_total_fc = total_ticketprice_fc + gst_fc

              grand_total_wfc = total_ticketprice_wfc + gst_wfc

              Family = (Children + Adults)//4

              

              #Receipt for Wednesday show with Family Combo

              print("*"*44)

              print(" "*18 + "Receipt")

              print("*"*44)

              print("Children Ticket(s): $%.2f"%c_ticketprice)

              print("Adult Ticket(s): $%.2f"%a_ticketprice)

              print("Senior Ticket(s): $%.2f"%s_ticketprice)

              print("Family Combo Ticket(s): $%.2f"%fc_ticketprice)

              print("*"*44)

              print("<Discount>")

              print("Weekday Discount: $%.2f"%wkday_disc_fc)

              print("*"*44)

              print("GST: $%.2f"%gst_fc)

              print("Grand Total: $%.2f"%grand_total_fc)

              print("*"*44)  

              

              #If user chooses Wednesday show and Family Combo criteria not met

          else:

              Family = (Children + Adults)//4

              c_ticketprice = Children*70

              a_ticketprice = Adults*50

              s_ticketprice = Seniors*30

              fc_ticketprice = 0.8*(2*50 + 2*70)*Family

              total_ticketprice_fc = c_ticketprice + a_ticketprice + s_ticketprice + fc_ticketprice

              total_ticketprice_wfc = c_ticketprice + a_ticketprice + s_ticketprice

              wkday_disc_fc = 0.1*total_ticketprice_fc

              wkday_disc_wfc = 0.1*total_ticketprice_wfc

              seats_taken = Children + Adults + Seniors

              gst_fc = 0.07*total_ticketprice_fc

              gst_wfc = 0.07*total_ticketprice_fc

              grand_total_fc = total_ticketprice_fc + gst_fc

              grand_total_wfc = total_ticketprice_wfc + gst_wfc

              

              #Receipt for Wednesday show without Family Combo

              print("*"*44)

              print(" "*18 + "Receipt")

              print("*"*44)

              print("Children Ticket(s): $%.2f"%c_ticketprice)

              print("Adult Ticket(s): $%.2f"%a_ticketprice)

              print("Senior Ticket(s): $%.2f"%s_ticketprice)

              print("*"*44)

              print("<Discount>")

              print("Weekday Discount: $%.2f"%wkday_disc_wfc)

              print("*"*44)

              print("GST: $%.2f"%gst_wfc)

              print("Grand Total: $%.2f"%grand_total_wfc)

              print("*"*44)

               

              #If user chooses Saturday show 

              if Date == 0:

              

             #If user chooses Saturday show with Family Combo

               if Children and Adults >= 2:

             #Receipt for Saturday show with Family Combo

                print("*"*44)

                print(" "*18 + "Receipt")

              print("*"*44)

              print("Children Ticket(s): $%.2f"%c_ticketprice)

              print("Adult Ticket(s): $%.2f"%a_ticketprice)

              print("Senior Ticket(s): $%.2f"%s_ticketprice)

              print("Family Combo Ticket(s): $%.2f"%fc_ticketprice)

              print("*"*44)

              print("GST: $%.2f"%gst_fc)

              print("Grand Total: $%.2f"%grand_total_fc)

              print("*"*44)

              

              #Receipt for Saturday show without Family Combo

else:

              print("*"*44)

              print(" "*18 + "Receipt")

              print("*"*44)

              print("Children Ticket(s): $%.2f"%c_ticketprice)

              print("Adult Ticket(s): $%.2f"%a_ticketprice)

              print("Senior Ticket(s): $%.2f"%s_ticketprice)

              print("*"*44)

              print("<Discount>")

              print("Weekday Discount: $%.2f"%wkday_disc_wfc)

              print("*"*44)

              print("GST: $%.2f"%gst_wfc)

              print("Grand Total: $%.2f"%grand_total_wfc)

              print("*"*44)

Solution by an expert tutor
Blurred Solution