-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
64 lines (54 loc) · 1.71 KB
/
main.py
File metadata and controls
64 lines (54 loc) · 1.71 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
57
58
59
60
61
62
63
64
"""
generate bill
"""
# DRY: Do not Repeat Yourself
from electronics import Electronics
from grocery import Grocery
from furniture import Furniture
from toys import Toys
from cloths import Cloths
from products import Products
e1 = Electronics("Asus TUF F15", 56000, 86000, 10, "Rechargable Battery")
# e1.show_details()
g1 = Grocery("Kissan Ketchup", 90, 135, 50, "12/24")
# g1.show_details()
f1 = Furniture("Chair",30000,35000,5,"Wood")
f1.show_details()
while True:
print("Enter:\n1 to add new product to inventory")
print("2 to delete a product")
print("3 to view a product details")
print("4 to edit a product details")
print("5 to view the entire inventory")
print("9 to exit\n")
op = int(input())
if op == 1:
print("Enter:\n\t1 to add an Electronics item")
print("\t2 to add a Furniture")
print("\t3 to add Grocery")
print("\t4 to add Cloth")
print("\t5 to add Toy")
item_type = int(input()) # 3
lookup = {
1 : Electronics.addNewItem,
2 : Furniture.addNewItem,
3 : Grocery.addNewItem,
4 : Cloths.addNewItem,
5 : Toys.addNewItem
}
lookup[item_type]()
elif op == 2:
index = Products.showInventory()
Products.all_products[index] = None
elif op == 3:
index = Products.showInventory()
Products.all_products[index].show_details()
elif op == 4:
index = Products.showInventory()
Products.all_products[index].editDetails()
elif op == 5:
pass
elif op == 9:
break
else:
print("Invalid Choice ! ReEnter the number...")