-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathitem.py
61 lines (58 loc) · 1.93 KB
/
item.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
class item:
#Dynamically set the attributes for the item class based off of the name passed to it
def __init__(self, name):
self.name = name
#Define prices of items in the store
self.al_price = 2
self.to_price = 1
self.sa_price = 1
self.pe_price = 1
self.hb_price = 20
self.sb_price = 15
self.spb_price = 15
self.db_price = 20
self.sf_price = 8
self.suf_price = 12
self.pp_price = 15
self.cc_price = 4
self.ph_price = 400
self.ca_price = 600
self.ta_price = 800
self.la_price = 1000
#Returns the price of each item listed
def get_price(self, name):
if self.name == "aluminum foil":
return self.al_price
elif self.name == "toothpaste":
return self.to_price
elif self.name == "salt":
return self.sa_price
elif self.name == "pepper":
return self.pe_price
elif self.name == "Harry Potter Book":
return self.hb_price
elif self.name == "SW Design Book":
return self.sb_price
elif self.name == "Spiderman Book":
return self.spb_price
elif self.name == "Diary of a Wimpy Kid Book":
return self.db_price
elif self.name == "Spiderman Figure":
return self.sf_price
elif self.name == "Superman Figure":
return self.suf_price
elif self.name == "Pikachu Plushy":
return self.pp_price
elif self.name == "Charizard Card":
return self.cc_price
elif self.name == "Phone":
return self.ph_price
elif self.name == "Camera":
return self.ca_price
elif self.name == "Tablet":
return self.ta_price
elif self.name == "Laptop":
return self.la_price
#Returns name of item
def get_name(self):
return self.name