aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhongheng Liu <z.liu@outlook.com.gr>2025-02-06 09:49:40 +0200
committerZhongheng Liu <z.liu@outlook.com.gr>2025-02-06 09:49:40 +0200
commit6fdd8b6737ed7e018900ceaf2fcec3d926839912 (patch)
tree58a46f7ec2ba203b31d6e2525269735b8ea57c58
parent4d873ac8e2e642118e04c1b5b1515e12cb655bde (diff)
downloadcs-y13-6fdd8b6737ed7e018900ceaf2fcec3d926839912.tar.gz
cs-y13-6fdd8b6737ed7e018900ceaf2fcec3d926839912.tar.bz2
cs-y13-6fdd8b6737ed7e018900ceaf2fcec3d926839912.zip
car thing
-rw-r--r--car.py15
-rw-r--r--py-class.py21
2 files changed, 36 insertions, 0 deletions
diff --git a/car.py b/car.py
new file mode 100644
index 0000000..4104b42
--- /dev/null
+++ b/car.py
@@ -0,0 +1,15 @@
+class Company:
+ def __init__(self, company_name: str, email: str, date_last: str):
+ self.__company_name = company_name
+ self.__email = email
+ self.__date_last = date_last
+ def set_date(self, d):
+ self.__date_last = d
+ def get_name(self):
+ return self.__company_name
+ def get_email(self):
+ return self.__email
+ def get_date(self):
+ return self.__date_last
+
+c = Company("XX Co. Ltd.", "example@example.com", "date")
diff --git a/py-class.py b/py-class.py
index de1440e..c4eec79 100644
--- a/py-class.py
+++ b/py-class.py
@@ -6,5 +6,26 @@ class Student:
def displayExamMark(self):
print(f"{self.__name} got {self.__examMark} marks")
+
+class PartTimeStudent(Student):
+ def __init__(self, name: str, dateOfBirth: str, examMark: int):
+ self.__isFullTime = False
+ super().__init__(name, dateOfBirth, examMark)
+ def time(self):
+ return "Full time" if self.__isFullTime else "Part time"
+
+
+class FullTimeStudent(Student):
+ def __init__(self, name: str, dateOfBirth: str, examMark: int):
+ self.__isFullTime = True
+ super().__init__(name, dateOfBirth, examMark)
+ def time(self):
+ return "Full time" if self.__isFullTime else "Part time"
+
+
myStudent = Student("Example Exampleperson", "1989-06-04", 69)
myStudent.displayExamMark()
+myFullStudent = FullTimeStudent("Dwayne Johnson", "1999-9-9", 80)
+myPartStudent = PartTimeStudent("Jake Paul", "1999-9-9", 0)
+myPartStudent.displayExamMark()
+myFullStudent.displayExamMark()