Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this Python project, you are to modify the Employee class posted on Blackboard by adding a bonus field. The bonus field should be equal

For this Python project, you are to modify the Employee class posted on Blackboard by adding a bonus field. The bonus field should be equal to zero when an Employee object is created. You need to add a setter and a getter method to the new bonus field.

The Diranys company saves all employee information in the dirany.txt file (attached). The file saves each employees information in a new line and all attributes are separated by tabs. For example, the first employees information on the first line in the dirany.txt file is as follows:

John Smith 90000

John is the first name of the employee, Smith is the employees last name and 90000 is the employees annual salary.

Your program should read the dirany.txt file and create an Employee object for each employee in the file, then add the employees to a queue data structure in the same order you read them from the file. The Diranys company saves the employees records according to their longevity in the company.

You need to help the Diranys company, to calculate the bonus for each employee according to their longevity rule so the bonus of the first employee will be 20% of his/her salary and for each employee afterwards the percent of the bonus will be 1%less so the second employee will get 19% of his/her salary, the third employee will get 18% of his/her salary and so forth.

Your program should access the Employees objects in the queue, calculate the bonus field and set it for each Employee object and display the object status: first name, last name, pay and bonus for each employee.

Also your program should calculate and display the number of the employees in the company and the total bonus that the company will pay for all its employees.

Make sure you break up your code into a set of well-defined functions. Each function should include a comment block that briefly describes it, its parameters and any return values.image text in transcribedimage text in transcribed

Employee.py - E\SCSU\Data Structures Assignment4 ClaudioEverettlEmployee.py (3.6.1) File Edit Format Run Options Window Help #this program is to demo the use of cla33e3 class Employee: def -init-(self, first, last,pay) : self.first-first self. last=last self.pay-pay self.email-firstt'.'lastt'company.com' def getPay (self): return self.pay def setPay (self,pay): self.pay-pay def fullName (self) return 't".format (self.first, self.last) def str (self): return Employee name: "+self.fullName + Employee pay: '+tr (self.pay) Ln: 1 Col:0 Employee.py - E\SCSU\Data Structures Assignment4 ClaudioEverettlEmployee.py (3.6.1) File Edit Format Run Options Window Help #this program is to demo the use of cla33e3 class Employee: def -init-(self, first, last,pay) : self.first-first self. last=last self.pay-pay self.email-firstt'.'lastt'company.com' def getPay (self): return self.pay def setPay (self,pay): self.pay-pay def fullName (self) return 't".format (self.first, self.last) def str (self): return Employee name: "+self.fullName + Employee pay: '+tr (self.pay) Ln: 1 Col:0

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

Students also viewed these Databases questions