-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDiscount.py
65 lines (48 loc) · 1.95 KB
/
Discount.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
class Discount:
def __init__(self, code, condition, start_date, expiry_date, status, used):
self.set_code(code)
self.set_condition(condition)
self.set_start_date(start_date)
self.set_expiry_date(expiry_date)
self.set_status(status)
self.set_used(used)
def set_code(self, code):
self.__code = code
def set_condition(self, condition):
self.__condition = condition
def set_start_date(self, start_date):
self.__start_date = start_date
def set_expiry_date(self, expiry_date):
self.__expiry_date = expiry_date
def set_status(self,status):
self.__status = status
def set_used(self,used):
self.__used = used
def get_code(self):
return self.__code
def get_condition(self):
return self.__condition
def get_start_date(self):
return self.__start_date
def get_expiry_date(self):
return self.__expiry_date
def get_status(self):
return self.__status
def get_used(self):
return self.__used
class AmountDiscount(Discount):
def __init__(self, code, condition, start_date, expiry_date, status, used, discount_amount):
super().__init__(code, condition, start_date, expiry_date, status, used)
self.set_discount_amount(discount_amount)
def set_discount_amount(self, discount_amount):
self.__discount_amount = discount_amount
def get_discount_amount(self):
return self.__discount_amount
class PercentageDiscount(Discount):
def __init__(self, code, condition, start_date, expiry_date,status, used, discount_percentage):
super().__init__(code, condition, start_date, expiry_date, status, used)
self.set_discount_percentage(discount_percentage)
def set_discount_percentage(self, discount_percentage):
self.__discount_percentage = discount_percentage
def get_discount_percentage(self):
return self.__discount_percentage