Write a program to process weekly employee time cards for all employees of an or
ID: 3633025 • 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 from program !!!
Explanation / Answer
#include<stdio.h>
void main()
{
FILE *fd;
int i=1;
int id,hrs;
float rate,pay,avg=0;
if((fd=fopen("EmpData.txt","r"))==NULL)
{
perror("fopen");
exit(1);
}
while(fscanf(fd,"%d %f %d ",id,rate,hrs)!=EOF)
{
if(hrs<=40)
pay=hrs*rate;
else
pay=(hrs*rate)*0.0362;
avg+=pay;
i++;
printf("EmpID:%dPay=%f",id,pay);
}
avg=avg/i;
printf("Average pay:%f",avg);
}//end main
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.