-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuserInfo.py
More file actions
56 lines (42 loc) · 1.62 KB
/
userInfo.py
File metadata and controls
56 lines (42 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
class UserData:
def __init__(self, income: float, GPA: float, gender: str, ethnicity: str,
major: str, university: str, location: str):
self.__GPA = GPA
self.__income = income
self.__gender = gender
self.__ethnicity = ethnicity
self.__major = major
self.__university = university
self.__location = location
def get_income(self) -> float:
return self.__income
def get_gpa(self) -> float:
return self.__GPA
def get_gender(self) -> str:
return self.__gender
def get_ethnicity(self) -> str:
return self.__ethnicity
def get_major(self) -> str:
return self.__major
def get_university(self) -> str:
return self.__university
def get_location(self) -> str:
return self.__location
def set_income(self, income: float) -> None:
if income < 0:
raise ValueError("Income must be a non-negative value.")
self.__income = income
def set_income(self, GPA: float) -> None:
if GPA < 0:
raise ValueError("GPA must be a non-negative value.")
self.__GPA = GPA
def set_gender(self, gender: str) -> None:
self.__gender = gender
def set_ethnicity(self, ethnicity: str) -> None:
self.__ethnicity = ethnicity
def set_major(self, major: str) -> None:
self.__major = major
def set_university(self, university: str) -> None:
self.__university = university
def set_location(self, location: str) -> None:
self.__location = location