-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathid_sys.py
More file actions
96 lines (65 loc) · 1.62 KB
/
id_sys.py
File metadata and controls
96 lines (65 loc) · 1.62 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
'''
System for registering e.g. people with personal IDs
'''
# imports
# vars
areas = ["Bay Area"]
visitors = [0] # list of visitor's CIDs // CID 0 --> Placeholder.. starting visitors with 1
# classes
class Visitor:
def __init__(self, cid, name, age, height, area):
# Init Func for Visitors #
self.cid = cid
self.name = name
self.age = age
self.height = height
self.area = area
# getters
def getCId(self):
return self.cid
def getName(self):
return self.name
def getAge(self):
return self.age
def getHeight(self):
return self.height
def getArea(self):
return self.area
# setters
def setCId(self, pId):
self.cid = pId
def setName(self, pName):
self.name = pName
def setAge(self, pAge):
self.age = pAge
def setHeight(self, pHeight):
self.height = pHeight
def setArea(self, pArea):
self.area = pArea
def getVisitors(self):
global visitors
print(visitors)
# funcs for Visitors
def getNextCId(self):
global visitors
self.nextCId = max(visitors) + 1
return self.nextCId
def addVstorToLst(self):
global visitors
self.setCId(self.getNextCId())
visitors.append(self.cid)
#TODO: add func for getting visitors name from cid...
# main
def main():
global visitors
print("Visitors before doing anything: {0}".format(visitors))
jeff = Visitor(0, "Jeff", 24, 176, "Bay Area")
jeff.addVstorToLst() # adding jeffs cid
print("Visitors after adding Jeff: {0}".format(visitors))
tim = Visitor(0, "Tim", 23, 182, "Bay Area")
tim.addVstorToLst() # adding tims cid
print("Visitors after adding Tim: {0}".format(visitors))
print(visitors[1])
# calling main-loop
main()
print("")