-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathassignment_4_main.py
74 lines (54 loc) · 1.53 KB
/
assignment_4_main.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
"""
File: main.py
Author: Br. Burton
This file tests the customer, order, and product classes for
assignment 04. You should not need to change this file.
"""
from customer import Customer
from order import Order
from product import Product
def main():
print("### Testing Products ###")
p1 = Product("1238223", "Sword", 1899.99, 10)
print("Id: {}".format(p1.id))
print("Name: {}".format(p1.name))
print("Price: {}".format(p1.price))
print("Quantity: {}".format(p1.quantity))
p1.display()
print()
p2 = Product("838ab883", "Shield", 989.75, 6)
print("Id: {}".format(p2.id))
print("Name: {}".format(p2.name))
print("Price: {}".format(p2.price))
print("Quantity: {}".format(p2.quantity))
p2.display()
print("\n### Testing Orders ###")
# Now test Orders
order1 = Order()
order1.id = "1138"
order1.add_product(p1)
order1.add_product(p2)
order1.display_receipt()
print("\n### Testing Customers ###")
# Now test customers
c = Customer()
c.id = "aa32"
c.name = "Gandalf"
c.add_order(order1)
c.display_summary()
print()
c.display_receipts()
# Add another product and order and display again
p3 = Product("2387127", "The Ring", 1000000, 1)
p4 = Product("1828191", "Wizard Staff", 199.99, 3)
order2 = Order()
order2.id = "1277182"
order2.add_product(p3)
order2.add_product(p4)
c.add_order(order2)
print()
c.display_summary()
print()
c.display_receipts()
if __name__ == "__main__":
main()