$24
Here is a description of the classes you need to create:
1.1 Address
This class should have a constructor which takes the following optional parameters (default values given in brackets)
house_no (0)
street (0)
city ("")
country ("")
These should be saved as class fields of the same names.
Following functions must be created in the class:
1. get_full_address: takes no parameters, returns a string in the following format:
H. No. 2, Street 3, Peshawar Pakistan
(where 2 is the house_no, 3 is the street and Peshawar and Pakistan are city and country respectively.)
2. Dunder function for str: this function should simply call get_full_address and return the string produced by that function.
1.2 Employee
This class should have a constructor which takes the following optional parameters (default values given in brackets)
id (1)
name (None)
It should also set fields current_address and permanent_address to None.
Following functions must be created in the class:
1. set_current_address: takes in a house_no, street, city and country. It should create an object of class Address with the information given and save it as member field by the name current_address
2. set_permenent_address: Same as above except field name must be permanent_address
3. get_current_address: Should return the string representation of current_address
4. get_permanent_address: Should return the string representation of permanent_address
5. Dunder function for str: this should produce a string in the following format:
11 Ali H. No. 1, Street 2, Cape Town South Africa
(where 11 is the id, Ali is the name and the rest of it is the string representation of permanent_address.)
1.3 Lecturer
1.3 Lecturer
1. This class should inherit from Employee class. It should have a constructor which takes in no parameters from the caller. This constructor should call the constructor of its parent with the id value of 1 and name value of ’Mr. Bigshot’.
2. Dunder function for str: this should produce a string in the following format:
Lecturer: 1 Mr. Bigshot H. No. 44, Street 24, KL Malaysia
(where the word lecturer is hard coded and the rest is the string representation of its parent class. There is a single space between Lecturer and the digit 1.)
• Submission
Use python run.py local to ensure all tests are passing and then submit your assignment using python run.py
remote
If you wish to request an extension, use the autograder UI to do so. Each student gets a maximum of 3 extension days per semester.
CS218 - Data Structures (Fall 2019 - Assignment: A02) Page 2 of 2