forked from fenyx-it-academy/Class4-PythonModule-Week5
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProduct.py
More file actions
49 lines (37 loc) · 1.33 KB
/
Product.py
File metadata and controls
49 lines (37 loc) · 1.33 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
class Product:
def __init__(self):
self.Pid = ""
self.Pname = ""
self.Pcostprice = 0.0
self.Psellprice = 0.0
self.Margin = 0.0
self.Remarks = ""
def GetDetails(self):
self.Pid = input("Enter Product ID:")
self.Pname = input("Enter Product Name :")
self.Pcostprice = input("Enter Cost Price")
self.Psellprice = input("Enter Selling Price")
self.SetRemarks()
def SetRemarks(self):
self.Margin = int(self.Psellprice) - int(self.Pcostprice)
if self.Margin < 0:
self.SetRemarks = "Loss "
else:
self.SetRemarks = "Profit"
def SetDetails(self):
print ("Product ID:", self.Pid)
print ("Product Name:", self.Pname)
print("Cost Price:", self.Pcostprice)
print("Selling Price:", self.Psellprice)
print("Margin:", self.Margin)
print("Incurred:", self.SetRemarks)
def showAll(self):
return """ Product ID: {} Product Name: {}
Cost Price: {}
Selling Price: {}
Margin: {}
Incurred: {}
""".format(self.Pid,self.Pname,self.Pcostprice,self.Psellprice, self.Margin, self.SetRemarks)
new_product=Product()
new_product.GetDetails()
print(new_product.showAll())