Question
Modify the following Python code to have Marlu and Ashis as the names, add an age attribute and an attribute to indicate what class we
Modify the following Python code to have Marlu and Ashis as the names, add an age attribute and an attribute to indicate what class we each teach to the Employee class. Additionally, update the constructor and the displayEmployee to include the new attributes in addition to the existing attributes of name and salary. Turn in the updated code and a screen shot of the output with the updated information.
Marlu and Ashis both teach object oriented class.
________________________
#!/usr/bin/python
class Employee:
#'Common base class for all employees'
empCount = 0
def __init__(self, name, salary):
self.name = name
self.salary = salary
Employee.empCount += 1
def displayCount(self):
print("Total Employee ", Employee.empCount)
def displayEmployee(self):
print("Name : ", self.name, ", Salary: ", self.salary)
"This would create first object of Employee class"
emp1 = Employee("Zara", 2000)
"This would create second object of Employee class"
emp2 = Employee("Manni", 5000)
emp1.displayEmployee()
emp2.displayEmployee()
print("Total Employees: ", Employee.empCount)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started