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

Having trouble with this code. I have to make a weekly payroll program with a te

ID: 3651814 • Letter: H

Question

Having trouble with this code. I have to make a weekly payroll program with a text file. The instructions are thus.


Write a program to read a text payroll text file, calculate pay, and print a weekly payrolll roster. Hours worked over 40 hours are paid overtime. Assume the federal income tax (FIT) rate is 15%.


Input (text file):


For each payroll record , read and assign date to the following fields.


1. Employee name (15 char)

2. Hours worked (2 int)

3. Hourly pay rate (5.2 float)


Text file (payroll.dat):


Use the data give below to create the payroll file. The numbers shown above the columns correspond to the fields described in the input.


1 2 3

Tanya Bauer 40 7.50

Dana Clark 45 14.90

Sara Erickson 38 12.00

Scott Howard 42 9.75

Paul Irwin 48 8.72

Dale Miller 40 10.25

Bret Rossi 35 8.00

Karen Thomas 48 9.00

Tracy York 36 11.00



Output (printer):


Print the following weekly payroll report:


Author Weekly Payroll Report page 01


Employee Name Hours Worked Regular Pay Overtime pay gross pay FIT Net pay


x------------x 99 999.99 99.99 9999.99 99.99 999.99

: : : : : : :

: : : : : : :

x-------------x 99 999.99 99.99 9999.99 99.99 999.99


Totals: 9999.99 999.99 99999.99 999.99 9999.99


Processing Requirements:


Read the payroll file


Compute the regular pay:


if hours > 40,

then regular pay = 40 * pay rate

else regular pay = hours * pay rate


Compute the overtime pay:


if hours > 40,

then overtime pay = (hours - 40) * 1.5 * pay rate

else overtime = 0


Compute the gross pay:

regular pay + overtime pay


Compute the federal income tax:

gross pay * FIT rate


Compute the net pay:

gross pay - FIT


Accumulate totals for regular pay, overtime pay, gross pay, FIT, and net pay.


Been having a lot of trouble getting this set up the way it needs to look, an earlier code didn't quite work out and need some help on just what the code needs to look like.

Explanation / Answer

#include #include #include #include using namespace std; //**********// int main() { const int empId = 7; //Number of employees int workers[empId] = {5658846, 4520125, 7895122, 8777541, 8451277, 1302850, 7580489}; //Employee ID numbers int hours[empId]; //Holds hours worked double payRate[empId]; //Holds pay rates //Input the hours worked and the hourly pay rate. cout
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