Create a Person Class and a Student class that inherits from it. All input data for both classes is as strings. Expected methods and their behaviors are as follows:

Class Person: firstName, lastName and SSN must be provided. Also to be initialized: phones starts as an empty set and address starts as . Note that the zyBook does not cover the set class but it can be thought of as a dictionary without values. You can easily find useful relevant methods and their syntax online. An empty set is created with something like myEmptySet = set()

Methods that must be included:

__init__ - Requires firstName, LastName, SSN and nothing else.

__str__ -see outputs below.

printAll see outputs below. Prints < none> if no phone is currently specified.

The actions for the following should be obvious from the name or by looking at the sample code below: getFirstName, setFirstName, getLastName, setLastName, getSSN, getAddress, setAddress, addPhone, delPhone. There is no setSSN method. getPhones produces a sorted list.

Class Student: Must inherit from Person. Also needs techID and grades which is initialized as an empty dictionary which will have courses as keys and their grades as the associated values.

printAll see outputs below. This is different than the printAll in Person. Prints < none> if no phone has been specified and also if no courses are in the grades dictionary.

addCourse add a course ID and its associated grade value to the grades dictionary. Also used to change a course grade. Grades are always stored and shown in upper case even if entered lower case.

dropCourse remove a course from the grades dictionary. Dropping non-existent courses does not cause an error. A course can only be dropped if its grade begins with I

Sample testing code and output that it should produce are on the next pages. This testing code is also on D2L. Note that not all of the specifications above are tested by the following code but you should implement and test these features.

if __name__ == "__main__":
per1 = Person("Joe", "Smith", "111-22-3333")
per2 = Person("Lisa", "Hernandez", "222-33-4444")
per2.setAddress("123 South St #456, Chicago, IL, 61111")
per2.addPhone("312-234-5678")
per2.addPhone("800-888-9990")
print(per1)
print(per2)
print()
per1.printAll()
print()
per2.printAll()
print()
print("Result of getPhones():", per2.getPhones())
print()
stu1 = Student("Mary", "Jones", "234-56-1234", "00112233")
stu1.setAddress("333 N Main St, Dallas, TX 75150")
stu2 = Student("Bill", "Chen", "876-76-7676", "12345433")
stu2.addPhone("214-999-0011")
stu2.addCourse("IT 210", "IP")
stu2.addCourse("ENG 271W", "IP")
stu2.addCourse("MATH 121", "IP")
print(stu1)
print(stu2)
print()
stu1.printAll()
print()
stu2.printAll()
stu2.addCourse("IT 210", "a") # Change grade
stu2.dropCourse("ENG 271W") # Drop existing course
stu2.dropCourse("ENG 101") # Dropping a non-existent course does nothing
stu2.addPhone("214-999-5511")
stu2.delPhone("214-999-0011") # Delete existing phone
stu2.delPhone("999-999-9999") # Delete non-existent phone does nothing
print()
stu2.printAll()

Output:

Smith, Joe SSN=111-22-3333
Hernandez, Lisa SSN=222-33-4444

Smith, Joe SSN=111-22-3333
< no address>
Phone(s):
< none>

Hernandez, Lisa SSN=222-33-4444
123 South St #456, Chicago, IL, 61111
Phone(s):
312-234-5678
800-888-9990

Result of getPhones(): ['312-234-5678', '800-888-9990']

Jones, Mary techID=00112233
Chen, Bill techID=12345433

Jones, Mary techID=00112233
333 N Main St, Dallas, TX 75150
Phone(s):
< none>
Courses:
< none>

Chen, Bill techID=12345433
< no address>
Phone(s):
214-999-0011
Courses:
ENG 271W IP
IT 210 IP
MATH 121 IP

Chen, Bill techID=12345433
< no address>
Phone(s):
214-999-5511
Courses:
IT 210 A
MATH 121 IP
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.