Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Probabilistic Databases

Authors: Dan Suciu, Dan Olteanu, Christopher Re, Christoph Koch

1st Edition

3031007514, 978-3031007514

More Books

Students also viewed these Databases questions

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago