/* ******************************************************* * Author: Nikitas N. Karanikolas, Assistant Professor * * Creation Date: February 21, 2009 * ******************************************************* */ #include #include "types.h" #define overtime_multiplyer 1.50 #define saturday_multiplyer 1.75 #define sunday_multiplyer 2.00 void employee_payroll(personnel_rec emp, int overtime_hours, int saturday_hours, int sunday_hours) { int i; char tmp_str[snamesize+1]; float total = emp.salary + emp.salary/175*overtime_hours*overtime_multiplyer + emp.salary/175*saturday_hours*saturday_multiplyer + emp.salary/175*sunday_hours*sunday_multiplyer; printf("%s ",emp.key); strcpy(tmp_str, emp.sname); for (i=strlen(emp.sname); i0 */ { /* abnormal case */ fprintf(stderr,"There is an overtime transaction " "with key [%s] that does not corresponds to an " "employee. ", ot.key); fprintf(stderr,"This overtime transaction will be " "ignored.\n"); eof2=fread(&ot,sizeof(overtime_rec),1,fp2)<1; } while (!eof1) { employee_payroll(emp,0,0,0); eof1=fread(&emp,sizeof(personnel_rec),1,fp1)<1; } fclose(fp1); fclose(fp2); }