forked from Tonguesten36/pp2023
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PGSIM (beta).py
282 lines (282 loc) · 12.4 KB
/
PGSIM (beta).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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
#create a public governmental services information management system (birth, marriage, death, divorce, etc.)
class citizen:
def __init__(self, name, id, DoB, nationality, place_of_origin, place_of_residence, marriage, spouse):
self.name = name
self.id = id
self.DoB = DoB
self.nationality = nationality
self.place_of_origin = place_of_origin
self.place_of_residence = place_of_residence
self.marriage = marriage
self.spouse = spouse
class management:
def __init__(self):
self.citizen = {}
def add_citizen(self):
print ("Enter the following information:")
citizen.name = input("Name: ")
citizen.id = input("ID: ")
citizen.DoB = input("Date of birth: ")
citizen.nationality=("Nationality:")
citizen.place_of_origin = input("Place of origin: ")
citizen.place_of_residence = input("Place of residence: ")
citizen.marriage = input("Marriage status: ")
if citizen.marriage == "married":
citizen.spouse = input("Spouse: ")
else:
citizen.spouse = "none"
self.citizen[citizen.id] = citizen
def add_marriage(self):
husband=citizen()
wife=citizen()
print ("Enter the following information:")
husband.name = input("Name of the first citizen: ")
husband.id = input("ID of the first citizen: ")
if husband.marriage == "married":
print ("The first citizen is already married.")
return
wife.name = input("Name of the second citizen: ")
wife.id = input("ID of the second citizen: ")
if wife.marriage == "married":
print ("The second citizen is already married.")
return
marriage_date = input("Date of marriage: ")
marriage_place = input("Place of marriage: ")
marriage_certificate = input("Marriage certificate: ")
self.marriage = {husband, wife, marriage_date, marriage_place, marriage_certificate}
husband.marriage = "married"
wife.marriage = "married"
husband.spouse = wife.name
wife.spouse = husband.name
self.citizen[citizen.id] = citizen
def add_divorce(self):
husband=citizen()
wife=citizen()
print ("Enter the following information:")
husband.name = input("Name of the first citizen: ")
husband.id = input("ID of the first citizen: ")
if husband.marriage == "single":
print ("The first citizen is not married.")
return
wife.name = input("Name of the second citizen: ")
wife.id = input("ID of the second citizen: ")
if wife.marriage == "single":
print ("The second citizen is not married.")
return
divorce_date = input("Date of divorce: ")
divorce_place = input("Place of divorce: ")
divorce_certificate = input("Divorce certificate: ")
self.divorce = {husband, wife, divorce_date, divorce_place, divorce_certificate}
husband.marriage = "single"
wife.marriage = "single"
husband.spouse = "none"
wife.spouse = "none"
self.citizen[citizen.id] = citizen
def birth_declaration(self):
print("Enter the following information:")
citizen.name = input("Name: ")
citizen.id = input("ID: ")
citizen.DoB = input("Date of birth: ")
citizen.Place_of_birth = input("Place of birth: ")
self.father = input("Father's name: ")
self.father_id = input("Father's ID: ")
self.mother = input("Mother's name: ")
self.mother_id = input("Mother's ID: ")
self.birth_certificate = input("Birth certificate: ")
self.birth = {citizen.name, citizen.id, citizen.DoB, citizen.Place_of_birth, self.father, self.father_id, self.mother, self.mother_id, self.birth_certificate}
self.citizen[citizen.id] = citizen
def death_declaration(self):
print("Enter the following information:")
citizen.name = input("Name: ")
citizen.id = input("ID: ")
citizen.DoB = input("Date of birth: ")
citizen.place_of_origin = input("Place of origin: ")
citizen.place_of_residence = input("Place of residence: ")
self.reasion_of_death = input("Reason of death: ")
self.date_of_death = input("Date of death: ")
self.place_of_death = input("Place of death: ")
self.death_certificate = input("Death certificate: ")
self.death = {citizen.name, citizen.id, citizen.DoB, citizen.place_of_origin, citizen.place_of_residence, self.reasion_of_death, self.date_of_death, self.place_of_death, self.death_certificate}
self.citizen[citizen.id] = citizen
def change_name(self):
self.search_citizen()
self.new_name = input("New name: ")
self.change_name_certificate = input("Change name certificate: ")
self.change_name = {citizen.name, citizen.id, self.new_name, self.change_name_certificate}
self.citizen[citizen.id] = citizen
def print_citizen(self, citizen):
print("Name: ", citizen.name)
print("ID: ", citizen.id)
print("Date of birth: ", citizen.DoB)
print("Nationality: ", citizen.nationality)
print("Place of origin: ", citizen.place_of_origin)
print("Place of residence: ", citizen.place_of_residence)
print("Marriage status: ", citizen.marriage)
if citizen.marriage == "married":
print("Spouse: ", citizen.spouse)
def search_citizen(self):
print("Enter the following information:")
citizen.name = input("Name: ")
citizen.id = input("ID: ")
if self.citizen[citizen.id] == citizen:
print("The citizen is found.")
self.print_citizen(citizen)
else:
print("The citizen is not found.")
def search_marriage(self):
print("Enter the following information:")
self.husband = input("Husband's name: ")
self.husband_id = input("Husband's ID: ")
self.wife = input("Wife's name: ")
self.wife_id = input("Wife's ID: ")
if self.marriage == {self.husband, self.wife}:
print("The marriage is found.")
else:
print("The marriage is not found.")
def search_birth(self, citizen):
print("Enter the following information:")
citizen.name = input("Name: ")
citizen.id = input("ID: ")
if self.birth == {citizen.name, citizen.id}:
print("The birth is found.")
else:
print("The birth is not found.")
def search_death(self, citizen):
print("Enter the following information:")
citizen.name = input("Name: ")
citizen.id = input("ID: ")
if self.death == {citizen.name, citizen.id}:
print("The death is found.")
else:
print("The death is not found.")
def search_divorce(self):
print("Enter the following information:")
self.husband = input("Husband's name: ")
self.husband_id = input("Husband's ID: ")
self.wife = input("Wife's name: ")
self.wife_id = input("Wife's ID: ")
if self.divorce == {self.husband, self.wife}:
print("The divorce is found.")
else:
print("The divorce is not found.")
def delete_citizen(self):
print("Enter the following information:")
citizen.name = input("Name: ")
citizen.id = input("ID: ")
if self.citizen[citizen.id] == citizen:
del self.citizen[citizen.id]
print("The citizen is deleted.")
else:
print("The citizen is not found.")
def delete_marriage(self):
print("Enter the following information:")
self.husband = input("Husband's name: ")
self.husband_id = input("Husband's ID: ")
self.wife = input("Wife's name: ")
self.wife_id = input("Wife's ID: ")
if self.marriage == {self.husband, self.wife}:
del self.marriage
print("The marriage is deleted.")
else:
print("The marriage is not found.")
def delete_birth(self, citizen):
print("Enter the following information:")
citizen.name = input("Name: ")
citizen.id = input("ID: ")
if self.birth == {citizen.name, citizen.id}:
del self.birth
print("The birth is deleted.")
else:
print("The birth is not found.")
def delete_death(self):
print("Enter the following information:")
citizen.name = input("Name: ")
citizen.id = input("ID: ")
if self.death == {citizen.name, citizen.id}:
del self.death
print("The death is deleted.")
else:
print("The death is not found.")
def delete_divorce(self):
print("Enter the following information:")
self.husband = input("Husband's name: ")
self.husband_id = input("Husband's ID: ")
self.wife = input("Wife's name: ")
self.wife_id = input("Wife's ID: ")
if self.divorce == {self.husband, self.wife}:
del self.divorce
print("The divorce is deleted.")
else:
print("The divorce is not found.")
def update_citizen(self):
print("Enter the following information:")
citizen.name = input("Name: ")
citizen.id = input("ID: ")
if self.citizen[citizen.id] == citizen:
citizen.name = input("Name: ")
citizen.id = input("ID: ")
citizen.DoB = input("Date of birth: ")
citizen.place_of_origin = input("Place of origin: ")
citizen.place_of_residence = input("Place of residence: ")
self.citizen[citizen.id] = citizen
print("The citizen is updated.")
else:
print("The citizen is not found.")
def update_marriage(self):
print("Enter the following information:")
self.husband = input("Husband's name: ")
self.husband_id = input("Husband's ID: ")
self.wife = input("Wife's name: ")
self.wife_id = input("Wife's ID: ")
if self.marriage == {self.husband, self.wife}:
self.husband = input("Husband's name: ")
self.husband_id = input("Husband's ID: ")
self.wife = input("Wife's name: ")
self.wife_id = input("Wife's ID: ")
self.marriage = {self.husband, self.wife}
print("The marriage is updated.")
else:
print("The marriage is not found.")
def update_birth(self):
print("Enter the following information:")
citizen.name = input("Name: ")
citizen.id = input("ID: ")
if self.birth == {citizen.name, citizen.id}:
citizen.name = input("Name: ")
citizen.id = input("ID: ")
citizen.DoB = input("Date of birth: ")
citizen.place_of_origin = input("Place of origin: ")
citizen.place_of_residence = input("Place of residence: ")
self.birth = {citizen.name, citizen.id, citizen.DoB, citizen.place_of_origin, citizen.place_of_residence}
print("The birth is updated.")
else:
print("The birth is not found.")
def update_death(self):
print("Enter the following information:")
citizen.name = input("Name: ")
citizen.id = input("ID: ")
if self.death == {citizen.name, citizen.id}:
citizen.name = input("Name: ")
citizen.id = input("ID: ")
citizen.DoB = input("Date of birth: ")
citizen.place_of_origin = input("Place of origin: ")
citizen.place_of_residence = input("Place of residence: ")
self.death = {citizen.name, citizen.id, citizen.DoB, citizen.place_of_origin, citizen.place_of_residence}
print("The death is updated.")
else:
print("The death is not found.")
def update_divorce(self):
print("Enter the following information:")
self.husband = input("Husband's name: ")
self.husband_id = input("Husband's ID: ")
self.wife = input("Wife's name: ")
self.wife_id = input("Wife's ID: ")
if self.divorce == {self.husband, self.wife}:
self.husband = input("Husband's name: ")
self.husband_id = input("Husband's ID: ")
self.wife = input("Wife's name: ")
self.wife_id = input("Wife's ID: ")
self.divorce = {self.husband, self.wife}
print("The divorce is updated.")
else:
print("The divorce is not found.")