Employee Details Automation
Employee Details Automation
IMPORTANT INSTRUCTIONS
1. Please read the document thoroughly before you code.
2. Import the given skeleton code into your Eclipse.
3. Use Java 8 for solving the business requirement.
4. Run the database script provided to set up your database.
5. You have to test the code and ensure there are no compilation errors before submission.
A. BUSINESS SCENARIO
The “Survivor” hospital has decided to give bonus for all permanent employees who are
working extra time in hospital besides their normal shift in this pandemic situation. The
hospital management find it very difficult to deal with the total salary calculation based on
their levels and extra working hours. So, they decides to outsource the salary calculation
process to their software consultant. You being their software consultant automate the above
task.
The Hospital Management has the following business processes that must be automated.
1. Parse data and calculate total salary for all the permanent employees
Import the attached skeleton code into your eclipse project and implement the required
functionalities. The skeleton also has a .SQL file which can be used to set up your database.
D. TECHNICAL REQUIREMENTS
For both the functional requirements 1 and 2, component specifications and method
specifications are given below. Please follow the same order to implement them using the code
skeleton.
(refer Skeleton)
Responsibilities Reads the input file, filters the records after validation of employee number and
then builds the EmployeeDetails object and returns it.
Design The input file format is .txt and is comma separated (Sample rows are
Constraints added. You can add any number of rows to test your service class, from
the main method)
Do not hard code the input file path inside any method – has to be used
from the input argument only as per the code skeleton.
Exceptional While doing File I/O in the ApplicationUtil.readFile method catch all exceptions
Conditions including application specific InvalidEmployeeNumberException .
employeeNumber
HospitalManageme buildEmployeeList () List <String> static
nt employeeRecords ArrayList<Employee
Details>
level2 50000
level3 35000
Employee Details Automation
level4 25000
Note: Total salary can be calculated by adding basic salary and 1000 rs per extra working
hour for their respective levels
For example: If the extra working hours is 13 for a permanent employee of level3 , then the
total salary is calculated by adding basic salary (here for level3 35000) and 1000 per extra
working hour( 13*1000)
=35000+13000
=48000
Resources database.properties – has connection details, used to establish database connection.
Process Flow Modify the HospitalManagement.buildEmployeeList() method set the
EmployeeDetails objects after calculating the total salary using
HospitalManagement.calculateTotalSalary().
After reading the file, building records as ArrayList<EmployeeDetails>, call the
DetailsDAO.insertEmployeeList method to insert values to the database. The
database will contain only validated employee records.
If the insert has happened successfully, return true; otherwise, false.
Exceptional While working with DAO methods catch all exceptions and throw an application specific
Conditions exception, InvalidEmployeeNumberException.
Note: You are allowed to modify the input file text to incorporate more test data for various test scenarios /
boundary conditions. Test your application by invoking the service methods from the main class, main ()
method. Follow Java Naming Conventions, test the code quality by running the PMD rules in Eclipse or any
other IDE that you use.
PR47856,Steven,level1,24
TR87965,Sujatha,level1,12
PR78965,Seetha,level3,12
PR7895,Vaishnav,level2,6
PR78995,Yamuna,level2,25
PR78999,John,level4,13
TR88888,Wilsy,level4,16
PR12356,Nelson,level1,27
PR85203,Mithun,level3,11
PR47856,Steven,level1,24,99000
PR78965,Seetha,level3,12,47000
PR78995,Yamuna,level2,25,75000
PR78999,John,level4,13,38000
PR12356,Nelson,level1,27,102000
PR85203,Mithun,level3,11,46000