Please code in python Create a program with two classes – the person class and the student The person class has the following properties: first name (first_name), last name (last_name) street address (address) city (city) zip code (zip) The class has the following methods: get_full_name, which returns the full name of a person get_full_address, which return greeting, returns a greeting message. The class should provide accessor and mutator for each property The class should override the __str__ method to return the state of the object. Create a child class called student which has a property named graduation year (graduation_year) and major. Provide accessor and mutator for each property of its own It inherits all the properties and methods of the person parent class as well. Create a test program that Create an object of the person class and print the full name of a person. Create an object of the person class and print the full name and address of a person. Create an object of the student class and execute the print full name by calling the get_full_name method found in the person class. Print the major and graduation year of the student. The greeting printed will be like “Welcome, first name, last name, “to the class of”, graduation year”.
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Please code in python
- Create a program with two classes – the person class and the student The person class has the following properties:
- first name (first_name),
- last name (last_name)
- street address (address)
- city (city)
- zip code (zip)
The class has the following methods:
- get_full_name, which returns the full name of a person
- get_full_address, which return
- greeting, returns a greeting message.
The class should provide accessor and mutator for each property
The class should override the __str__ method to return the state of the object.
- Create a child class called student which has a property named graduation year (graduation_year) and major.
Provide accessor and mutator for each property of its own
It inherits all the properties and methods of the person parent class as well.
- Create a test program that
- Create an object of the person class and print the full name of a person.
- Create an object of the person class and print the full name and address of a person.
- Create an object of the student class and execute the print full name by calling the get_full_name method found in the person class. Print the major and graduation year of the student.
- The greeting printed will be like “Welcome, first name, last name, “to the class of”, graduation year”.
Step by step
Solved in 3 steps with 2 images