Question: This is the code from LAB 2 class Employee: #constructor def __init__(self,empl_num,name,birth_month,birth_year,job_title,salary): self.empl_num=empl_num self.name=name self.birth_Month=birth_month self.birth_year=birth_year self.job_title=job_title self.salary=salary #Function to calculate hourly pay def hourly_rate(self):

This is the code from LAB 2

class Employee: #constructor def __init__(self,empl_num,name,birth_month,birth_year,job_title,salary): self.empl_num=empl_num self.name=name self.birth_Month=birth_month self.birth_year=birth_year self.job_title=job_title self.salary=salary #Function to calculate hourly pay def hourly_rate(self): return self.salary/2080 #function to calculate age def age(self,month,year): # month=birth_Month-month if month65): return True else: return False #to string method def __str__(self): template='{0.empl_num} {0.name} {0.birth_Month} {0.birth_year} {0.job_title} {0.salary}' return template.format(self)

#Main method or test method def main(): #Instantiate an object e1=Employee('E12345','Ashok',2,2000,'Lawyer',100000) #Print using _str_ print(e1) #display current age print('Age=',e1.age(9,2018)) #Display current salary print('Salary Per Hour=%.2f'%e1.hourly_rate()) #display current retirement status print('Retirement status=',e1.can_retire(9,2018)) if __name__== "__main__": main()

THIS IS THE ASSIGNMENT

This is the code from LAB 2 class Employee: #constructor def __init__(self,empl_num,name,birth_month,birth_year,job_title,salary):self.empl_num=empl_num self.name=name self.birth_Month=birth_month self.birth_year=birth_year self.job_title=job_title self.salary=salary #Function to calculate hourly pay defhourly_rate(self): return self.salary/2080 #function to calculate age def age(self,month,year): # month=birth_Month-month if

In this assignment you are asked to enhance the Python program created in Lab #2 to define a class to model the characteristics of a generic employee. The class is part of a slightly larger program that includes code to use the class to create some employee objects and test its methods. The name of the class is 'Employee' and includes the following methods and attributes (repeated from last week's Lab) Method Name Purpose npu Output/returns init Constructor - sets initial values for all object See belowaNone attributes Displays a readable version of the Emplovee object Calculates and returns the employee's hourly rate of pay- divides salary by 2080 Returns the employee's current age in yearsToday's str None Employee data as a rintable strin Hourly rate (float) hourly rate None age age (int) subtracts today's year from birth year, but month (int) accounts for month differences (i.e, if birth and todav's month occurs before today's month, age is year(int) current year minus birth year, otherwise that minus I If age > 65, returns 'True' - employee is eligible to retire. Otherwise, 'False Today's month (int) and today':s can retire True or False ear(int Attributea empl num name birth month birth year ob title salar Definition ID: "E" +5 digits Emplovee name - " " Integer in range 1 to 12 Integer, 4 digits, range 1800 and above Is this a currently enrolled student? "v". "n" Annual salary: integer in range 0 to 1000000 int int Int In this assignment you are asked to enhance the Python program created in Lab #2 to define a class to model the characteristics of a generic employee. The class is part of a slightly larger program that includes code to use the class to create some employee objects and test its methods. The name of the class is 'Employee' and includes the following methods and attributes (repeated from last week's Lab) Method Name Purpose npu Output/returns init Constructor - sets initial values for all object See belowaNone attributes Displays a readable version of the Emplovee object Calculates and returns the employee's hourly rate of pay- divides salary by 2080 Returns the employee's current age in yearsToday's str None Employee data as a rintable strin Hourly rate (float) hourly rate None age age (int) subtracts today's year from birth year, but month (int) accounts for month differences (i.e, if birth and todav's month occurs before today's month, age is year(int) current year minus birth year, otherwise that minus I If age > 65, returns 'True' - employee is eligible to retire. Otherwise, 'False Today's month (int) and today':s can retire True or False ear(int Attributea empl num name birth month birth year ob title salar Definition ID: "E" +5 digits Emplovee name - " " Integer in range 1 to 12 Integer, 4 digits, range 1800 and above Is this a currently enrolled student? "v". "n" Annual salary: integer in range 0 to 1000000 int int Int

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!