-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproduct.py
More file actions
56 lines (46 loc) · 1.53 KB
/
product.py
File metadata and controls
56 lines (46 loc) · 1.53 KB
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
class product(object):
def __init__(self,price,name,weight,brand,cost,status):
self.price = price
self.name = name
self.weight = weight
self.brand = brand
self.cost = cost
self.status = "for sale"
if price == 0:
self.status = "sold"
if cost == str("return"):
self.status = "return"
self.price = 0
if cost == str ("closed box return"):
self.status = "like new"
self.status = "for sale"
if cost == str ("open box return"):
self.status = "used"
self.price = self.price*.8
def tax(self, tax):
self.price = 1+tax * self.price
print self.price
return self
def profit(self):
self.price = self.cost * 1.2
print self.profit
return self
# def returned(why):
# if why == "defect":
# self.status == "defect"
# self.price == 0
# elif why == "damage":
# self.price == self.price * .8
# else:
# self.status == "for sale"
# return self
def displayInfo(self):
print "The price is " + str(self.profit)
print "the name is " + str(self.name)
print "The weight is " + str(self.weight)
print "the brand is "+ str(self.brand)
print "the cost is "+ str(self.cost)
print self.status
return self
juice = product(4, "OJ", "64oz", "tropicana",3,"sold" )
print juice.tax(.08).displayInfo()