#include <stdio.h>

#define NUM_EMPL 5 /* number of employees to process */
#define OVERTIME_RATE 1.5f /* Overtime pay rate is 1.5 times regular wage */
#define STD_WORK_WEEK 40.f /* 40 hours equals standard work week for pay calculation; beyond that is Overtime Pay */

/* Global structure below for the employee with members of Employee ID, Hourly Wage, Hours Worked, */
/* Overtime Hours Worked, and Gross Pay Earned */

struct employee
{
int id_number;
float wage;
float hours;
float overtime;
float gross;
};

/* Function Prototypes */

struct employee* readEmployee (struct employee emp[NUM_EMPL]);
void Output_Results_Screen (struct employee emp [NUM_EMPL]);

/* add functions here */
/* each function needs the description box */
struct employee* readEmployee(struct employee emp[NUM_EMPL])
{
int i = 0;
for (i = 0; i < NUM_EMPL; i++) {
printf("\nEnter the number of hours of employee %d: ", emp[i].id_number);
scanf("%f", &emp[i].hours);
if (emp[i].hours > STD_WORK_WEEK) {
emp[i].overtime = emp[i].hours - STD_WORK_WEEK;
emp[i].gross = (STD_WORK_WEEK * emp[i].wage + emp[i].overtime * emp[i].wage * OVERTIME_RATE);
} else {
emp[i].overtime = 0;
emp[i].gross = (emp[i].hours * emp[i].wage);
}
}
return emp;
}

void Output_Results_Screen (struct employee emp [NUM_EMPL] )
{
int i;

printf ("\n\t----------------------------------------------------------\n");
printf ("\tClock # Wage Hours OT Gross\n");
printf ("\t----------------------------------------------------------\n");

for (i = 0; i < NUM_EMPL; i++) {
printf("\t%06i %5.2f %5.1f %5.1f %7.2f\n", emp[i].id_number, emp[i].wage, emp[i].hours, emp[i].overtime,
emp[i].gross);
}
}

int main()
{
/* Set up a local variable to store the employee information */
struct employee emps[NUM_EMPL] = {
{ 98401, 10.60 },
{ 526488, 9.75 },
{ 765349, 10.50 },
{ 34645, 12.25 },
{ 127615, 8.35}
};
readEmployee(emps);
Output_Results_Screen (emps);

return 0;
}
