Print ('Employee Number: ',emp. Thank you for the help the code is now workingĬlass Employee: def _init_(self,name,number):Ĭlass ProductionWorker(Employee): def _init_(self,name,number,shift_num,pay_rate):Äef main(): print('enter following Details of the Employee') The Production Worker class should add extra attributes called shiftnumber (an integer, either 1 or 2) and payrate. Next, write a class named Production Worker that is a subclass of the Employee class. Print ('Shift Number',emp.get_shift_num()) ASK AN EXPERT Engineering Computer Science Create a class called Employee that contains two attributes: name and number. Number = input('Enter Employee Number: ')Ä®mp = ProductionWorker(emp_name, number, sh, pay) I use Påharm to make me easily spot where the errors are: class Employee:Ä®mp_name = input('Enter Employee Name: ') Here is the runnable code that you can try. The output is : enter following Details of the Employeeįile "D:/chapter11probelm1.py", line 48, in įile "D:/chapter11probelm1.py", line 42, in mainįile "D:/chapter11probelm1.py", line 12, in get_emp_nameĪttributeError: 'ProductionWorker' object has no attribute '_Employee_number' My Production worker constructor says explicitly invoke another constructor. The Production Worker class should have fields to hold the following information: Shift (an integer) Hourly pay rate (a double). Hello I'm new to Java, I'm getting this error in my production worker class. The day shift is shift 1 and the night shift is shift 2. The shift field will be an integer value representing the shift the employee works. Print ('Shift Number',emp.get_shift_number()) 27 This question already has answers here : Java error: Implicit super constructor is undefined for default constructor (12 answers) Closed 9 years ago. The ProductionWorker class should have fields to hold the following information: Shift (an integer) Hourly pay rate (a double) The workday is divided into two shifts: day and night. The TeamLeader class should have fields for the monthly bonus amount, the required number of training hours, and the number of training hours that the team leader has attended. Print ('Employee Number',emp.get_emp_number()) Design a TeamLeader class that extends the ProductionWorker class you designed in Programming Challenge 1. I use Påharm to make me easily spot where the errors are: class Employee: def init(self,name,number): self.name. Number = input ('Enter Employee Number: ')Ä®mp = ProductionWorker(name,number,sh,pay) Here is the runnable code that you can try. Print('enter following Details of the Employee') Employee and Production Worker Classes Design a class named Employee. class Employee:Äef _init_(self,name,number,shift_num,pay_rate): enter following Details of the Employee Enter Employee Name: john Enter Employee Number: 12 Enter Shift Number: 2 Enter Pay Rate: 10 Details of Employee: Traceback (most recent call last): File 'D:/chapter11probelm1.py', line 48, in main () File 'D:/chapter11probelm1.py', line 42, in main print Name,emp.Hi i do not know were the error is i have looked threw several times and cant seam to find the problem and after hrs of tinkering i do not want to mess it up any more then i have aready.
0 Comments
Leave a Reply. |