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

Needs to be in basic pseudocode. 2) A company maintains its employee records in

ID: 3869154 • Letter: N

Question

Needs to be in basic pseudocode.

2) 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.

Assume that the following declarations have already been made

num id

string employeeName

num hourlyPay

num hoursWorked

num benefitsContribution

num retirementContribution

num grossPay

num incomeTax

num netPay

Declare any other variables and constants that are needed and write pseudocode so that your program can

a) Read each record in the employees.txt file

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

c) Calculate 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) Write 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

Example of what I'm looking for.

start

Declarations

num itemPrice

num salespersonCommission

num customerDiscount

output “Welcome to the sales price calculator.”

output “This program will help you calculate the final”,

"price of a product adding in all factors.”

finalPrice= calculatePrice()

output “The total price after Commission, $” salespersonCommission, “and customer discount,”

“ customerDiscount “%, is”, finalPrice

stop

Explanation / Answer

Program Pseudocode

start program

DECLARATIONS::

num id

string employeeName

num hourlyPay

num hoursWorked

num benefitsContribution

num retirementContribution

num grossPay

num incomeTax

num netPay

num taxRate

---------------------------------------------------------------------------------

start function main()

output"Welcome to Employee Payroll Calculator."

call readEmployeesFile()

end main

----------------------------------------------------------------------------------

start function readEmployeesFile()

open file "employees.txt" in read mode

check if "employees.txt" file was opened or not,

if not opened then output "File employee.txt was not found".

and exit from program

open file "payroll.txt" in write mode

loop(line by line)

store name in variable employeeName

store hourly pay in variable hourlyPay

store hours worked in variable hoursWorked

store benefits contribution in variable benefitsContribution

store retirement contribution in variable retirementContribution

call calculatePayroll() for each employee

call writeToPayrollFile(payroll.txt filePointer)

end loop

close file "employees.txt"

close file "payroll.txt"

end function

----------------------------------------------------------------------------------------------

start function calculatePayroll(payroll.txt filePointer)

grossPay = (hourlyPay * hoursWorked) + benefitsContribution + retirementContribution

check if gross pay is equal to or more than 1000

if yes then assign taxRate = 10%

check if gross pay is equal to or more than 750 but less than 1000

if yes then assign taxRate = 7.5%

check if gross pay is equal to or more than 500 but less than 750

if yes then assign taxRate = 5

calculate incomeTax = (taxRate * grossPay)/100

calculate netPay = grossPay - incomeTax

end function

---------------------------------------------------------------------------------------

start function writeToPayrollFile(file_pointer)

file_pointer.write("Name:", employeeName, " Benefits: ", benefitsContribution,

" Retirement":, retirementContribution, " Income Tax: ", incomeTax,

" Net pay: ", netPay)

file_pointer.write(newLine)

end function

end program

NOTE: Please delete the lines -------------------- . This is used as separators from the modules.

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