I'm sort of stuck because I don't really know how the functions work here and how to actually READ the input and output file..... Here is the general concept of the problem
Many companies have a system where employees clock in and clock out to determine how much time they work each week. Since these records are already automatically stored in files on companies' computers, it only makes sense to use these files to help calculate how much each employee should get paid. In order to determine how much an employee gets paid each week, you need to know the following two pieces of information:
1) The number of hours they worked in a week
2) Their hourly pay rate
If an employee works 40 or less hours a week, then they simply get paid the number of hours they worked times their hourly pay rate. If an employee works more than 40 hours, then they get paid an extra 50% of their regular pay for the hours over 40 they worked. (For example, if an employee's pay rate is $10/hour and the employee works 50 hours, then he/she would get paid $550, because he/she gets $10x50 = 500 normally, plus an extra .5x(10 hr)x($10/hr) = $50 for his/her overtime.
Here's what i have so far,
Code:
#include <stdio.h>
#define WEEK 10
int main()
{
FILE *ifp, *ofp;
int Hr_in, Min_in, Hr_out, Min_out, Total_hr, num_empl;
float pay_rate[EMPLOYEES];
float total_time, pay;
char [WEEK];
ifp=fopen("clock.txt", "r");
ofp=fopen("payroll.txt", "w");
fscanf(ifp, "%d", &num_empl);
fprintf(ofp, Number of employees:"%d\n", num_empl);
for (index=0; index<num_empl; index++)
{
scanf(outfptr, "%f", pay_rate[index]);
}
return 0;
}
I know it's not much, but i'm TOTALLY confused by the input file, which is..
2
5.15
10.00
5
1 9 0 13 45
0 10 50 18 10
0 7 30 13 30
1 8 30 18 50
0 12 20 13 20
4
1 8 0 18 0
1 8 0 19 0
1 8 0 19 0
1 8 0 20 0
2
0 10 0 15 0
1 8 0 20 0
2
0 10 0 15 0
1 8 0 20 0
2
0 10 0 15 0
1 8 0 20 0
2
0 10 0 15 0
1 8 0 20 0
2
0 10 0 15 0
1 8 0 20 0
2
0 10 0 15 0
1 8 0 20 0
2
0 10 0 15 0
1 8 0 20 0
2
0 10 0 15 0
1 8 0 20 0
OUTPUT:
Number of employees: 2
Week 1
EmpID Hrs Pay
0 14.33 73.82
1 15.08 150.83
Week 2
EmpID Hrs Pay
0 0.00 0.00
1 44.00 460.00
Week 3
EmpID Hrs Pay
0 5.00 25.75
1 12.00 120.00
Week 4
EmpID Hrs Pay
0 5.00 25.75
1 12.00 120.00
Week 5
EmpID Hrs Pay
0 5.00 25.75
1 12.00 120.00
Week 6
EmpID Hrs Pay
0 5.00 25.75
1 12.00 120.00
Week 7
EmpID Hrs Pay
0 5.00 25.75
1 12.00 120.00
Week 8
EmpID Hrs Pay
0 5.00 25.75
1 12.00 120.00
Week 9
EmpID Hrs Pay
0 5.00 25.75
1 12.00 120.00
Week 10
EmpID Hrs Pay
0 5.00 25.75
1 12.00 120.00
Total
EmpID Hrs Pay
0 54.33 279.82
1 155.08 1570.83
any suggestions would help, and I know this is sort of long for you people to read
THANX VERY MUCH