Answer to Question #281754 in Python for Mutero

Question #281754

Demonstrate use of Object Oriented Programming (OOP) principles, data structures and file handling operations to carry out the following tasks:



a) Define a class named Person, with child classes named Daughter and Son who also have have derived classes named GrandSon and GrandDaughter respectively. All child classes have derived genetic features and skills from Person. Create 5 methods for getting and setting genetic features, setting and getting skills and demonstrate the concept of polymorphism.



b) Modify the answer in a) and show how the person features are captured in a file called person.txt. Also create another method to read from the file person.csv and store the data in a list called persondata. Clearly show how exceptions are handled in your program

1
Expert's answer
2021-12-21T17:20:47-0500
class Person:
    def __init__(self, name):
        self.name = name
    def say_hi(self):
        print("Hello,", self.name)


class Son(Person):
    pass


class Daughter(Person):
    pass


with open("input.txt", 'r') as reader:
     print(reader.read())

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS