-
Notifications
You must be signed in to change notification settings - Fork 0
/
order.py
31 lines (27 loc) · 843 Bytes
/
order.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
from user import user
class order:
#constructure
def __init__(self, user, total, items, onumber):
self.user = user
self.total = total
self.items = items
self.Onum = onumber
def orderHistory(self):
#write order history to file
orders = open("orders.txt", "a")
user_info = self.user.getInfo()
for i in user_info:
orders.write(str(i))
orders.write("\n")
for i in self.items:
orders.write(str(i))
orders.write("\n")
orders.write("Order Number: ")
orders.write(str(self.Onum))
orders.write("\n")
orders.close()
def showHistory(self):
#opens list of orders and prints
orders = open("orders.txt", "r")
print(orders.read())
orders.close()