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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!