Lab Please Create The Following Inheritance Tree With The Following Methods For The Purposes Of This Assignment Make A 1 (58.54 KiB) Viewed 54 times
Lab Please Create The Following Inheritance Tree With The Following Methods For The Purposes Of This Assignment Make A 2 (80.23 KiB) Viewed 54 times
Lab Please create the following inheritance tree with the following methods. For the purposes of this assignment, make attributes have default values except for the names (otherwise, it could get quite messy!). In other words, be sure that the graduate, undergraduate, and faculty classes take names as a default argument, and that's all. - A Cardinal has the following attributes and methods: o ID (attribute) o Mailing address (attribute) o Name (attribute) A Student is a type of Cardinal that has the following attributes and methods: o GPA (attribute) o o Home address (attribute) Major (attribute) O Classes (attribute - HINT: make this a list! Make the default an empty list) o Enroll_in_class (method) A Graduate is a type of Student that has the following attributes: o Undergrad_institution (attribute) An Undergraduate is a type of Student has the following attributes: o Year (attribute) A Faculty is a type of Cardinal that has the following attributes and methods: o Office (attribute) o Classes (attribute - HINT: make this a list! Make the default an empty list) o Classes Taught (method) This code should produce the following:
Dif name main': s1 = Undergraduate("Jane") s1.enroll_in_classes ("Introduction to Programming with Python") s2 Graduate ("Bob") = s2.enroll_in_classes ("Introduction to Social Work") s3 = Undergraduate("Carly") s3.enroll_in_classes ("Introduction to Programming with Python") s3.enroll_in_classes ("Introduction to Social Work") t1 = Faculty ("Pamela") t2 = Faculty("Julia") t1.classes_taught ("Introduction to Programming with Python") to Programming with C/C++") t2.classes_taught ("Introduction to Social Work") list_of_professors [t1, t2] tl.classes_taught("Introduction find_professors (s1, list_of_professors) find professors (s2, list_of_professors) find_professors (s3, list_of_professors) Jane is taking Introduction to Programming with Python with Pamela Bob is taking Introduction to Social Work with Julia Carly is taking Introduction to Programming with Python with Pamela Carly is taking Introduction to Social Work with Julia Additionally, in your code, make Jane a freshman and give her a GPA of 3.2. Make Carly a sophomore with a GPA of 3.7. Give Bob a 3.4 GPA and make his undergraduate institution Bellarmine. Set Pamela's office to be Duthie 224 and set Julia's office to be Sacket 309. For each Cardinal, choose one more attribute from the Cardinal or Student class to set (mailing address, home address, etc). I will not provide code for this... it is up to you to provide this in your code.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!