Answer to Question #297765 in Python for H A

Question #297765
  • Assignment 1.1: Employee class + get/set methods - Unlimited number of employees.
  • Assignment 1.2: Student class + get/set methods - Unlimited number of students.
1
Expert's answer
2022-02-14T15:04:30-0500
class Employee:
    def __init__(self, name, age, position):
        self.name = name
        self.age = age
        self.position = position

    def printInfo(self):
        print(f"""
Name: {self.name}
Age: {self.age}
Works as a {self.position}
            """)

class Student:
    def __init__(self, name, age, grade, favoriteItems):
        self.name = name
        self.age = age
        self.grade = grade
        self.favoriteItems = favoriteItems
    def printInfo(self):
        print(f"""
Name: {self.name}
Age: {self.age}
Studying in {self.grade}th grade
Favorite school subjects: {self.favoriteItems}
            """)
        
employee = Employee('Whilliam', 34, 'Teacher')
student = Student('John', 15, 10, ['Math', 'Biology'])

employee.printInfo()
student.printInfo()

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