Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Software applications often use classes and objects to encapsulate logic about the real world. For example, a company might have software to track information about

image text in transcribed
Software applications often use classes and objects to encapsulate logic about the real world. For example, a company might have software to track information about employees. Let's use your knowledge of Python to create a simple example of such a system. Create a program called 'employee.py that defines an 'Employee' class with the following default properties: e name Assign each person an employee id that is one integer higher than the last assigned value. Also compute a 'reverse name' property that shows last name first. Your program should also define two sub-classes that inherit from Employee and define their own specific attributes and methods: e Manager o workers a list of workers who report to this manager o repr returns the person's name and a list of workers Worker o manager the manager to whom this worker reports o repr -returns the person's reverse name, and the name of their manager Note your Worker class will need to update the manager's list of workers when setting the worker's manager value. You can test your program like this: from employee import managerl - ManagerC "Warren Buffett) >>workeri Worker("John Doe, manager1) > workerl Name: Doe, John, id: 2, reports to: Warren Buffett worker WorkerC"Jane Doe" >>worker Name: Doe, Jane, id: 3, reports to: -NA worker3 Worker("Joe Schmoe, manager1) >>manager Name: Warren Buffet investor, id: 1 Workers: 2 Doe, John

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

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

More Books

Students also viewed these Databases questions

Question

l Identify two general and three controversial types of tests.

Answered: 1 week ago

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago