Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The Timely Talent Temporary Help Agency maintains an employee master file that c

ID: 645078 • Letter: T

Question

The Timely Talent Temporary Help Agency maintains an employee master file
that contains an employee ID number, last name, first name, address, and hourly
rate for each temporary worker. The file has been sorted in employee ID number
order. Each week, a transaction file is created with a job number, address, customer
name, employee ID, and hours worked for every job filled by Timely Talent
workers. The transaction file is also sorted in employee ID order.


a. Design the logic for a program that matches the current week

Explanation / Answer

ResultSet rs = stmt.executeQuery("SELECT * FROM TransactionFile");
while(rs.next()){
   int empID = rs.getInt('employeeId');
   int jobNumber = rs.getInt('jobNumber');
   int hoursWorked = rs.getInt('hoursWorked');
   //till we get first employee record details in transaction
   //now we are fetching emploee details from master using emploee id
   ResultSet rs2 = stmt.executeQuery("SELECT * FROM Master where EmploeeId==empId");
   while(rs.next()){
       int hourlyRate = rs2.getInt('hourlyRate');
       //calculate gross salary
       int grossSalary = hourlyRate * hoursWorked;
       System.out.println(jobNumber+","+empID+","+hoursWorked+","+grossSalary);
       System.out.println(" ");//this is for new line...one record data in one line
   }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote