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

A company maintains its employee records in a sequential text file named employe

ID: 3778721 • Letter: A

Question

A company maintains its employee records in a sequential text file named employees.txt. The record for each employee contains the following: ID number, employee’s name, hourly pay, hours worked, benefits contribution, retirement account contribution. Design the logic, in pseudocode, for a program that

a) Reads each record in the employees.txt file

b) Calculates the employee’s gross pay, based on their hourly pay and how many hours they worked

c) Calculates the employee’s net pay after deducting the following:

i) the benefits contribution

ii) the retirement account contribution

iii) income tax, based on the following scale: (1) gross pay of 1,000 or more: 10% (2) gross pay of 750 or more but less than 1000: 7.5% (3) gross pay of 500 or more but less than 750: 5%

d) Writes the employee data along with the gross pay, benefits and retirement account contributions, income tax (in dollars), and net pay to another file named payroll.txt

Explanation / Answer

Read employeesFile

   empID = employeesFile[1]

   empName = employeesFile[2]

   hrsPay = employeesFile[3]

   hrsWorked = employeesFile[4]

   benefits = employeesFile[5]

   retirementAmt = employeesFile[6]

   for emp in employeeFile:
       grossPay = emp.hrsPay * emp.hrsWorked

       if grossPay >=1000
           percentageDeduction = 10

       else if (grossPay >= 750) and (grossPay < 1000)
           percentageDeduction = 7.5

       else if (grossPay >= 500) and (grossPay < 750)
           percentageDeduction = 5

       netpay = NetPay(grossPay,benefits,retirementAmt,percentageDeduction)

   Write to file payroll.txt

       writeline(empID,empName,grossPay,benefits,retirementAmt,netpay)
End Read.

NetPay (grossPay,benefits,retirementAmt,percentageDeduction)
  
   netpay = grossPay - benefits - retirementAmnt -(grossPay*percentageDeduction)
  
   return netpay

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