I need to make it so that the program calls for the user to input their name and number into the program. Code below. _________________________________________________________________________________________________________ class Employee: def __init__(self, name, number): self.__name = name self.__employee_number = number def set_name(self, name): self.__name = name def set_employee_number(self, number): self.__employee_number = number def get_name(self): return self.__name def get_employee_number(self): return self.__employee_number class ProductionWorker(Employee): def __init__(self, nume, number, shift_number, hourly_pay): if shift_number == 1 or shift_number == 2: self.__shift = shift_number else: raise ValueError('The shift number should either be 1 or 2.') self.__hourly_pay = float(hourly_pay) Employee.__init__(self, name, number) def set_shift_number(self, shift_number): if shift_number == 1 or shift_number == 2: self.__shift == shift_number else: raise ValueError('The shift number should either be 1 or 2.') def set_hourly_pay(self, hourly_pay): self.__hourly_pay = float(hourly_pay) def get_shift(self): if self.__shift == 1: return 'day' else: return 'night' def get_hourly_pay(self): return format(self.__hourly_pay, ',.2f')
I need to make it so that the program calls for the user to input their name and number into the program. Code below.
_________________________________________________________________________________________________________
class Employee:
def __init__(self, name, number):
self.__name = name
self.__employee_number = number
def set_name(self, name):
self.__name = name
def set_employee_number(self, number):
self.__employee_number = number
def get_name(self):
return self.__name
def get_employee_number(self):
return self.__employee_number
class ProductionWorker(Employee):
def __init__(self, nume, number, shift_number, hourly_pay):
if shift_number == 1 or shift_number == 2:
self.__shift = shift_number
else:
raise ValueError('The shift number should either be 1 or 2.')
self.__hourly_pay = float(hourly_pay)
Employee.__init__(self, name, number)
def set_shift_number(self, shift_number):
if shift_number == 1 or shift_number == 2:
self.__shift == shift_number
else:
raise ValueError('The shift number should either be 1 or 2.')
def set_hourly_pay(self, hourly_pay):
self.__hourly_pay = float(hourly_pay)
def get_shift(self):
if self.__shift == 1:
return 'day'
else:
return 'night'
def get_hourly_pay(self):
return format(self.__hourly_pay, ',.2f')
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images