Python 3 2 Implement Class Person Supports Methods Int Constructor Takes Input Person S Na Q37080725

Python 3+

2. Implement a class Person that supports these methods:

a) __int__(): A constructor that takes as input a person’s name(as a string) and birth year (as an integer)

b) age(): Returns the age of the person.

c) name(): Returns the name of the person

3. Implement following two subclasses of theclass person.

a) The class Instructor supports methods:

i) __int__(): Constructor that takes the person’s degree inaddition to name and birth year

ii) degree(): Returns the degree of the instructor.

iii) __repr__(self): Returns the canonical stringrepresentation      

iv) __str__(self): Returns the pretty print representation

b) The class Student, also a subclass of classPerson, supports:

i) __int__(): Constructor that takes the person’s

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.