Define an arraylist myemployees of employee type - within


The following tasks are to done in the indicated classes:

Task #0 - (in the SalariedEmployeeclass and the HourlyEmployee class)
• Fix the error due to extending the Employee superclass
o Note: the method for HourlyEmployee needs to get hours to compute weekly pay.
• Create the toString() method

Task #1 - Define an arrayList, myEmployees, of Employee type (in the EmployeeDemo class)

Task #2: (in the EmployeeDemo class)
Add a try-catch block to handle FileNotFound& any general Exception
Add a finally clause, but check that the file was created before closing it

Task #3: (in the EmployeeDemo class)
Open the input file, stored in the project's directory
Use a try-catch-finally block to handle the fileNotFound condition

Within the try-catch block:
read the salaryEmp.txt file until the end of the file
(firstName, lastName, annualSalary)
for each record read, create a SalariedEmployee object, and put inside arrayList of myEmployees

read the hourlyEmp.txt file until the end of the file
for each record read, create an HourlyEmployeeobject, and put inside myEmployeesarrayList
(firstName, lastName, wage)

Task #4:(in the EmployeeDemo class)
Write a loop that, for each employee, will polymorphically display the employee's data, ask the user for any missing data (hours), and thenpolymorphically calculate weeklyPay and display the pay.

Attachment:- PracticeMid.zip

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Define an arraylist myemployees of employee type - within
Reference No:- TGS02384614

Now Priced at $15 (50% Discount)

Recommended (92%)

Rated (4.4/5)