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

Write a program to process weekly employee time cards for all employees of an or

ID: 3632912 • Letter: W

Question

Write a program to process weekly employee time cards for all employees of an organization. Each employee will have three data items: an identification number, the hourly wage rate, and the number of hours worked during a given week. Each employee is to be paid time and a half for all hours worked over 40. A tax amount of 3.625 percent of gross salary will be deducted. The program output should show the employee’s number and net pay. Display the total payroll and the average amount paid at the end of the run.


please I need the right & full answer !!!

Explanation / Answer

#include #include /* declare functions */ /* Get the employee data */ void get_employee_data(FILE* fp,int* id, float* rate, float* hours); /* Calculate gross pay */ float calc_gross_pay(float rate, float hours); /* Calculate net pay */ float calc_net_pay(float gross_pay); /* Display results */ void display(FILE* fp,int id, float net_pay); int main() { int id; /* employee identification */ float rate; /* hourly wage */ float hours; /* hours worked */ float gross_pay; /* gross pay */ float net_pay; /* net pay */ float total_payroll=0; /* total payroll */ float average_payroll=0; /* total payroll */ int nums=0; /* number employees */ FILE *fpin; /* read file pointer */ FILE *fpout; /* write file pointer */ fpin = fopen("employees.in","r"); /* open file for reading */ /* check if file open */ if(fpin == NULL) { printf("file 'employees.in' cannot be opened for reading "); exit(1); /* close all file streams and terminate */ } fpout = fopen("employees.out","w"); /* open file for writing */ /* check if file open */ if(fpout == NULL) { printf("file 'employees.out' cannot be opened for writing "); exit(1); /* close all file streams and terminate */ } /* read employees in loop */ /* Get the employee data */ get_employee_data(fpin,&id, &rate, &hours); while(!feof(fpin)) { nums++; /* count employees */ /* Calculate gross pay */ gross_pay = calc_gross_pay(rate, hours); /* Calculate net pay */ net_pay = calc_net_pay(gross_pay); /* sum totals */ total_payroll = total_payroll + net_pay; /* Display results */ display(fpout,id, net_pay); /* get next employee data */ get_employee_data(fpin,&id, &rate, &hours); } /* close read file */ fclose(fpin); /* caculate average payents */ average_payroll = total_payroll / nums; /* print total */ fprintf(fpout," Total Payroll: %.2f Average Payroll: %.2f ",total_payroll, average_payroll); printf(" Total Payroll: %.2f Average Payroll: %.2f ",total_payroll, average_payroll); /* close write file */ fclose(fpout); return 0; } /* Get the employee data */ void get_employee_data(FILE* fp,int* id, float* rate, float* hours) { /* get employee id */ fscanf(fp,"%d",id); /* get employee id */ fscanf(fp,"%f",rate); /* get employee id */ fscanf(fp,"%f",hours); } /* Calculate gross pay */ float calc_gross_pay(float rate, float hours) { float gross_pay = 0; if(hours
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