Question: I need help finishing this java program Submit both HospitalEmployee and Hospital classes. Include output in Hospital class. [1] Update HospitalEmployee.java. Add the following new
Submit both HospitalEmployee and Hospital classes. Include output in Hospital class. [1] Update HospitalEmployee.java. Add the following new features to the HospitalEmployee class. If you have not completed the first HospitalEmployee assignment, you will need to do that first 1. Add another constructor method that will accept arguments which are passed into the eName, eNumber, hours, and pay parameters. The parameter variables are then assigned to empName, empNumber, hoursWorked and payRate instance variables. public HospitalEmployee(String eName, int eNumber, double hours, double pay) 2. Modify the mutator (set) methods setHoursWorked and setPayRate. Only allow hoursWorked and payRate to be set to values 0 or greater. 3. Create an overloaded method called calculateBonus. Remember that Java allows more than one method with the same name in a given class as long as the parameter list (formal argument list) is different. You can decide how you want to calculate an employee's bonus, although it cannot resemble code from our original calculateBonus. Your implementation must include a decision statement and/or 4. Add a static variable called hospitalEmployeeCount that will be used to count the number of HospitalEmployee objects created. Increment hospitalEmployeeCount in each of your constructors. Add a static method called getHospitalEmployeeCount that returns the number of HospitalEmployee 5. 6. objects created. [2) Update Hospital.java tester class. Add the following to your Hospital class, in the order given. l/create a HospitalEmployee called worker2 using the constructor added in this assignment lldisplay the state of worker Ildisplay the state of worker2 I/set the pay rate for the worker2 to 12.25. llset the hours worked for worker2 to 15 I/set the pay rate for worker2 to-10.50 Ildisplay the state of workerl Ildisplay the state of worker2 Ildisplay the employee name, and gross pay of worker2 Ildisplay the employee name and bonus for worker2. Use your new calculateBonus method. Ildisplay the number of HospitalEmployee objects created. Use getHospitalEmployeeCount() Submit both HospitalEmployee and Hospital classes. Include output in Hospital class. [1] Update HospitalEmployee.java. Add the following new features to the HospitalEmployee class. If you have not completed the first HospitalEmployee assignment, you will need to do that first 1. Add another constructor method that will accept arguments which are passed into the eName, eNumber, hours, and pay parameters. The parameter variables are then assigned to empName, empNumber, hoursWorked and payRate instance variables. public HospitalEmployee(String eName, int eNumber, double hours, double pay) 2. Modify the mutator (set) methods setHoursWorked and setPayRate. Only allow hoursWorked and payRate to be set to values 0 or greater. 3. Create an overloaded method called calculateBonus. Remember that Java allows more than one method with the same name in a given class as long as the parameter list (formal argument list) is different. You can decide how you want to calculate an employee's bonus, although it cannot resemble code from our original calculateBonus. Your implementation must include a decision statement and/or 4. Add a static variable called hospitalEmployeeCount that will be used to count the number of HospitalEmployee objects created. Increment hospitalEmployeeCount in each of your constructors. Add a static method called getHospitalEmployeeCount that returns the number of HospitalEmployee 5. 6. objects created. [2) Update Hospital.java tester class. Add the following to your Hospital class, in the order given. l/create a HospitalEmployee called worker2 using the constructor added in this assignment lldisplay the state of worker Ildisplay the state of worker2 I/set the pay rate for the worker2 to 12.25. llset the hours worked for worker2 to 15 I/set the pay rate for worker2 to-10.50 Ildisplay the state of workerl Ildisplay the state of worker2 Ildisplay the employee name, and gross pay of worker2 Ildisplay the employee name and bonus for worker2. Use your new calculateBonus method. Ildisplay the number of HospitalEmployee objects created. Use getHospitalEmployeeCount()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
