-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStorageClass.py
91 lines (66 loc) · 2.31 KB
/
StorageClass.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
class Product:
def __init__(self, productName, brand, thumbnail, subCategory, price, description, activated, quantity, stockThreshold):
self.__productName = productName
self.__brand = brand
self.__thumbnail = thumbnail
self.__subCategory = subCategory
self.__serialNo = ''
self.__price = float(price)
self.__description = description
self.__activated = activated
self.__quantity = quantity
self.__stock_threshold = stockThreshold
self.__views = 0
self.__purchases = 0
# Accessors
def get_product_name(self):
return self.__productName
def get_brand(self):
return self.__brand
def get_thumbnail(self):
return self.__thumbnail
def get_sub_category(self):
return self.__subCategory
def get_serial_no(self):
return self.__serialNo
def get_price(self):
return '%.2f' %float(self.__price)
def get_description(self):
return self.__description
def get_activated(self):
return self.__activated
def get_quantity(self):
return self.__quantity
def get_stock_threshold(self):
return self.__stock_threshold
def get_views(self):
return self.__views
def get_purchases(self):
return self.__purchases
# Mutators
def set_product_name(self, productName):
self.__productName = productName
def set_brand(self, brand):
self.__brand = brand
def set_thumbnail(self, thumbnail):
self.__thumbnail = thumbnail
def set_sub_category(self, subCategory):
self.__subCategory = subCategory
def set_serial_no(self, serialNo):
self.__serialNo = serialNo
def set_price(self, price):
self.__price = price
def set_description(self, description):
self.__description = description
def set_activated(self, activated):
self.__activated = activated
def set_quantity(self, quantity):
self.__quantity = quantity
def set_stock_threshold(self, stockThreshold):
self.__stock_threshold = stockThreshold
def increase_views(self):
self.__views += 1
def increase_purchases(self, amount):
self.__purchases += int(amount)
def increase_quantity(self, quantity):
self.__quantity += quantity