Question: You will have an error-filled Python programs, which you can download by clicking the link below. There is no errors in emp.py file. It only

You will have an error-filled Python programs, which you can download by clicking the link below.

There is no errors in emp.py file. It only define few classes. The second class, debugExercises11.py, creates a ShiftSupervisor object, and it has errors. By debugging these programs, you can gain expertise in program logic in general and the Python programming language in particular.

emp.py

# Programming Exercise 11-2

class Employee: def __init__(self, name, id_number): self.__name = name self.__id_number = id_number

def set_name(self, name): self.__name = name

def set_id_number(self, id_number): self.__id_number = id_number

def get_name(self): return self.__name def get_id_number(self): return self.__id_number class ProductionWorker(Employee): def __init__(self, name, id_number, shift_number, pay_rate): # Call superclass __init__ method. Employee.__init__(self, name, id_number)

# Initialize the shift_number and pay_rate attributes. self.__shift_number = shift_number self.__pay_rate = pay_rate

# Mutator functions for shift_number and pay_rate. def set_shift_number(self, shift_number): self.__shift_number = shift_number

def set_pay_rate(self, pay_rate): self.__pay_rate = pay_rate

# Accessor functions for shift_number and pay_rate. def get_shift_number(self): return self.__shift_number

def get_pay_rate(self): return self.__pay_rate

class ShiftSupervisor(Employee): def __init__(self, name, id_number, salary, bonus): # Call superclass __init__ method. Employee.__init__(self, name, id_number)

# Initialize the salary and bonus attributes. self.__salary = salary self.__bonus = bonus

# Mutator functions for salary and bonus. def set_salary(self, salary): self.__salary = salary

def set_bonus(self, bonus): self.__bonus = bonus

# Accessor functions for salary and bonus. def get_salary(self): return self.__salary

def get_bonus(self): return self.__bonus

DEBUG.py

# Programming Exercise 11-2

import emp

def main(): # Local variables super_name= '' super_id = '' super_salary = 0.0 super_bonus = 0.0 # Get data attributes. super_name = input('Enter the name: ') super_id = input('Enter the ID number: ') super_salary = float(input('Enter the annual salary: ')) super_bonus = float(input('Enter the bonus: '))

# Create an instance of ShiftSupervisor. supervisor = emp.ShiftSupervisor(super_id, super_name, \ super_salary, super_bonus)

# Display information. print ('Shift supervisor worker information: ') print ('Name:', supervisor.set_name()) print ('ID number:', supervisor.get_id_number()) print ('Annual Salary: $', \ format(supervisor.get_salary(), ',.2f'), \ sep = '') print ('Annual Production Bonus: $', \ format(supervisor.get_bonus(), ',.2f'), \ sep = '')

# Call the main function. main()

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!