Create a Python class named Persoon
. This class includes four instance variables, corresponding methods to retrieve these variables, methods to modify a limited number of variables, a constructor, and three additional methods:
An object of the Persoon
class must contain at least the following instance variables:
datetime.date
.The constructor of the Persoon
class should have the following signature:
__init__(name, first_name, residence, year_birth_date, month_birth_date, day_birth_date)
The constructor should utilize the datetime
module to initialize the birth date.
Each instance variable should have a corresponding method to retrieve it. The following methods are expected:
# Retrieve the person's name def get_naam(self) # Retrieve the person's first name def get_voornaam(self) # Retrieve the person's residence def get_woonplaats(self) # Retrieve the person's birth_date def get_geboorte_datum(self)
The instance variables name
and residence
should also be modifiable. Implement the following methods for this purpose:
# Modify the person's first name to new_first_name def set_voornaam(self, new_first_name) # Modify the person's residence to new_residence def set_woonplaats(self, new_residence)
Apart from the above methods, you also need to implement the following three methods. Note: For the methods is_ouder_dan
and is_jonger_dan
, if both persons have the same age, they should return False
.
# Returns True if the Person is older than other_person def is_ouder_dan(self, other_person) # Returns True if the person is younger than other_person def is_jonger_dan(self, other_person) # Returns True if both persons live in the same city def wonen_in_zelfde_stad(self, other_person)