Advertisement
AntoniiaG

Untitled

Jan 21st, 2024
645
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.12 KB | None | 0 0
  1. class Delivery:
  2.     def __init__(self, tracking_number, sender_office, receiver_office, sender_name, phone_number, amount, deadline):
  3.         self.tracking_number = tracking_number
  4.         self.sender_office = sender_office
  5.         self.receiver_office = receiver_office
  6.         self.sender_name = sender_name
  7.         self.phone_number = phone_number
  8.         self.amount = amount
  9.         self.deadline = deadline
  10.  
  11.     def display_info(self):
  12.         print(f"Tracking Number: {self.tracking_number}")
  13.         print(f"Sender Office: {self.sender_office}")
  14.         print(f"Receiver Office: {self.receiver_office}")
  15.         print(f"Sender Name: {self.sender_name}")
  16.         print(f"Phone number: {self.phone_number}")
  17.         print(f"Amount: {self.amount}")
  18.         print(f"Deadline: {self.deadline}")
  19.  
  20.     def change_deadline(self, new_deadline):
  21.         self.deadline = new_deadline
  22.  
  23. class PaymentMethod:
  24.     CARD = "Card"
  25.     BANK_TRANSFER = "Bank Transfer"
  26.     CASH_ON_DELIVERY = "Cash on Delivery"
  27.  
  28. class DeliveryMethod:
  29.     OFFICE_PICKUP = "Office Pickup"
  30.     AUTOMAT = "Automat"
  31.     HOME_DELIVERY = "Home Delivery"
  32.  
  33. class DeliveryManager:
  34.     def __init__(self):
  35.         self.deliveries = []
  36.  
  37.     def add_delivery(self, delivery):
  38.         self.deliveries.append(delivery)
  39.  
  40.     def check_tracking_number(self, phone_number):
  41.         return len(phone_number) == 13  # Проверка за дължина 10 символа
  42. if __name__ == "__main__":
  43.     delivery_manager = DeliveryManager()
  44.  
  45.     tracking_number = input("Enter tracking number: ")
  46.     sender_office = input("Enter sender office: ")
  47.     receiver_office = input("Enter receiver office: ")
  48.     sender_name = input("Enter sender name: ")
  49.     phone_number = int(input("Enter phone number: +359"))
  50.     amount = float(input("Enter amount: "))
  51.     deadline = input("Enter deadline (On Time or Delayed): ")
  52.  
  53.     delivery = Delivery(tracking_number, sender_office, receiver_office, sender_name, phone_number, amount, deadline)
  54.     print("\nУспешно регистрирана пратка!")
  55.     delivery.display_info()
  56.     print()
  57. #клас който да въведеш тел. номер и да ти принтира инф. за пратката
  58.     print("\nИнформация за получаване на пратка:")
  59.     delivery_manager.add_delivery(delivery)
  60.  
  61.     phnone_number_to_check = int(input("Enter phone number to check: +359"))
  62.     if phnone_number_to_check == delivery.phone_number:
  63.         print("Phone number is valid.\n")
  64.     else:
  65.         print("Invalid phone number.")
  66.  
  67.     new_deadline = input("Enter new deadline (On Time or Delayed): ")
  68.     delivery.change_deadline(new_deadline)
  69.     delivery.display_info()
  70.  
  71.     print()
  72.     print("1 - Плащане с карта \n"
  73.           "2 - Плащане в брой")
  74.  
  75.     payment = int(input("Изберете метод за плащане:"))
  76.     if payment == 1:
  77.         print("Плащане с карта")
  78.         payment_method = PaymentMethod.CARD    
  79.     else:
  80.         print("Плащане в брой")
  81.         delivery_method = DeliveryMethod.HOME_DELIVERY
  82.    
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement