Implement a Person class with the following attributes: Name: String Place of Birth: String Birthdate: Date Gender: String The constructor will receive the name and birthday date. The gender and the...


Implement aPerson class with the following attributes:




  • Name: String

  • Place of Birth: String

  • Birthdate: Date

  • Gender: String


The constructor will receive the name and birthday date. The gender and the place of birth should be initialized as empty strings.


Make the attributes private and create getter and setter methods. Write a __str__ method that prints the name and the age of the person (check the testcase for the format).


To calculate the age just subtract the year of birth to the current year (don't worry about the day/month, it is not an objective of this exercise). A datetime object has a
year
 attribute that is public.


To get the current date, use:


datetime.date.today()


which also has ayear attribute.



Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here