Advertisement
horozov86

restaurant

Jul 6th, 2023
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.39 KB | None | 0 0
  1. class Product:
  2.     def __init__(self, name, price):
  3.         self.__name = name
  4.         self.__price = price
  5.        
  6.     @property
  7.     def name(self):
  8.         return self.__name
  9.      
  10.     @property
  11.     def price(self):
  12.         return self.__price  
  13.        
  14. from project.product import Product  
  15. class Beverage(Product):
  16.     def __init__(self, name, price, milliliters):
  17.         super().__init__(self, name, price)
  18.         self.__milliliters = milliliters
  19.        
  20. from project.product import Product  
  21. class Food(Product):
  22.     def __init__(self, name, price, grams):
  23.         super().__init__(self, name, price)
  24.         self.__grams = grams
  25.        
  26. import
  27. class HotBeverage(Beverage):
  28.     def __init__(self, name, price, milliliters):
  29.         super().__init__(self, name, price, milliliters)
  30.        
  31. import
  32. class ColdBeverage(Beverage):
  33.     def __init__(self, name, price, milliliters):
  34.         super().__init__(self, name, price, milliliters)
  35.    
  36. import
  37. class Coffee(HotBeverage):
  38.     MILLILITERS = 50
  39.     PRICE = 3.50
  40.     def __init__(def __init__(self, name, caffeine):
  41.         super().__init__(self, name, self.PRICE, self.MILLILITERS, caffeine):
  42.             self.__caffeine = caffeine
  43.            
  44. class Starter(Food):
  45.    
  46. ........
  47.  
  48. class MainDish(Food):
  49.    
  50. ........
  51.  
  52. class Dessert(Food):
  53.    
  54. ........
  55.  
  56. class Salmon(MainDish):
  57.     GRAMS = 22
  58.     ......
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement