Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Why does Management class at end of code not work? class Vehicle: def __init__(self, vmk, vmd, vy, vml): self.__make = vmk self.__model = vmd self.__year

Why does Management class at end of code not work?

class Vehicle:

def __init__(self, vmk, vmd, vy, vml):

self.__make = vmk

self.__model = vmd

self.__year = vy

self.__mileage = vml

def get_make(self):

return self.__make

def get_model(self):

return self.__model

def get_year(self):

return self.__year

def get_mileage(self):

return self.__mileage

def set_make(self, vmk):

self.__make = vmk

def set_model(self, vmd):

self.__model = vmd

def set_year(self, vy):

self.__year = vy

def set_mileage(self, vml):

self.__mileage = vml

def __str__(self):

return "Make: " + self.__make + "; Model: " + self.__model + "; Year of Manufacture: " + str(self.__year) + "; Mileage: " + str(self.__mileage)

class Employee:

def __init__(self, nm, addr, veh):

self.__emp_name = nm

self.__emp_addr = addr

self.__vehicle = veh

def get_emp_name(self):

return self.__emp_name

def get_emp_addr(self):

return self.__emp_addr

def get_vehicle(self):

return self.__vehicle

def set_emp_name(self, nm):

self.__emp_name = nm

def set_emp_addr(self, addr):

self.__emp_addr = addr

def set_vehicle(self, veh):

self.__vehicle = veh

def compute_compensation(self):

pass

def __str__(self):

allData = " Employee Name: " + self.__emp_name

allData += "; Employee Address: " + str(self.__emp_addr)

allData +=" " + self.__vehicle.__str__()

return allData

class FullTimeEmployee(Employee):

def __init__(self, nm, addr, veh, sal):

#super().__init__(nm,addr,veh)

Employee.__init__(self,nm,addr,veh)

self.__salary = sal

def get_salary(self):

return self.__salary

def set_salary(self, sal):

self.__salary = sal

def compute_compensation(self):

if self.__salary <= 45000:

annual_compensation = self.__salary * (1 - 0.18)

elif self.__salary <= 82000:

annual_compensation = (self.__salary - 45000) * (1 - 0.28) + 36900

else:

annual_compensation = (self.__salary - 82000) * (1 - 0.33) + 63540

return (annual_compensation/52)

def compute_reimbursement(self,annual_expense):

if annual_expense <= 10000:

total_annual_reimbursement = annual_expense

else:

total_annual_reimbursement = 10000 + (annual_expense-10000)*0.5

total_weekly_reimbursement = total_annual_reimbursement/52

return total_weekly_reimbursement

def __str__(self):

childData = super().__str__()

childData = " Details of this Full Time Employee are:" + childData

childData += " Salary: " + '{0:0.2f}'.format(self.__salary)

return childData

class HourlyEmployee(Employee):

def __init__(self, nm, addr, veh, hw, hr):

#super().__init__(nm, addr, veh)

Employee.__init__(self,nm, addr, veh)

self.__hours_wrkd = hw

self.__hourly_rate = hr

def get_hours_worked(self):

return self.__hours_wrkd

def get_hourly_rate(self):

return self.__hourly_rate

def set_hours_worked(self, hw):

self.__hours_wrkd = hw

def set_hourly_rate(self, hr):

self.__hourly_rate = hr

def compute_compensation(self):

if self.__hours_wrkd > 40:

return self.__hourly_rate * 40 + self.__hourly_rate * 1.8 * (self.__hours_wrkd - 40)

else:

return self.__hourly_rate * self.__hours_wrkd

def compute_reimbursement(self,weekly_expense):

if weekly_expense <= 100:

total_weekly_reimbursement = weekly_expense

else:

total_weekly_reimbursement = 100

return total_weekly_reimbursement

def __str__(self):

childData = super().__str__()

childData = " Details of this Hourly Employee are:" + childData

childData += " Hours Worked: " + str(self.__hours_wrkd)

childData += "; Hourly Rate: " + str(self.__hourly_rate)

return childData

class Consultant(Employee):

def __init__(self, nm, addr, veh, hw, pt):

#super().__init__(nm, addr, veh)

Employee.__init__(self,nm, addr, veh)

self.__hours_wrkd = hw

self.__project_type = pt

def get_hours_worked(self):

return self.__hours_wrkd

def get_project_type(self):

return self.__project_type

def set_hours_worked(self, hw):

self.__hours_wrkd = hw

def set_project_type(self, pt):

self.__project_type = pt

def compute_compensation(self):

if self.__project_type == 1:

hrly_rate = 55

elif self.__project_type == 2:

hrly_rate = 70

else:

hrly_rate = 85

return self.__hours_wrkd * hrly_rate

def compute_reimbursement(self,weekly_expense):

if self.__project_type == 1:

total_weekly_reimbursement = weekly_expense

elif self.__project_type == 2:

total_weekly_reimbursement = weekly_expense*0.9

elif self.__project_type == 3:

total_weekly_reimbursement = weekly_expense*0.8

return total_weekly_reimbursement

def __str__(self):

childData = super().__str__()

childData = " Details of this Consultant are:" + childData

childData += " Hours Worked: " + str(self.__hours_wrkd)

childData += "; Project Type: " + str(self.__project_type)

return childData

class Management(FullTimeEmployee,Consultant):

def __init__(self, nm, addr, veh, sal, hw, pt):

FullTimeEmployee.__init__(self,nm, addr, veh, sal)

Consultant.__init__(self, nm, addr, veh, hw, pt)

def get(self):

return {'nm':self.emp_name,'addr':self.addr,'veh':self.veh,'salary':self.salary,'hoursWoked':self.hoursWorked,'ProjectType':self.ProjectType}

def set(self,name,addr,salary,hoursWoked,ProjectType):

self.emp_name = nm

self.addr = addr

self.veh = veh

self.salary = sal

self.hoursWorked = hw

self.ProjectType = pt

def compute_compensation(self):

from_full_time = FullTimeEmployee.compute_compensation(self)

from_consultant = Consultant.compute_compensation(self)

return from_full_time + from_consultant

def compute_reimbursement(self,annual_expense,weekly_expense):

from_full_time = FullTimeEmployee.compute_reimbursement(self,annual_expense)

from_consultant = Consultant.compute_reimbursement(self,weekly_expense)

return from_full_time + from_consultant

emp5=Management("Jane", "1000 W Campbell Road, Richardson, Texas, 75080",vehicle1,120000,10,3)

print(emp5)

print(" ")

print("{0} has an annual salary of ${1}.".format(emp5.get_emp_name(),emp5.get_salary()))

print("{0} works {1} hours per week for type {2} project.".format(emp5.get_emp_name(),emp5.get_hours_worked(),emp5.get_project_type()))

print("{0} has a weekly compensation of ${1:0.2f}.".format(emp5.get_emp_name(),emp5.compute_compensation()))

print("{0} has a weekly reimbursement of ${1:0.2f}.".format(emp5.get_emp_name(),emp5.compute_reimbursement(8000,300)))

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_2

Step: 3

blur-text-image_3

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions