#include <stdio.h>

// constants to use
#define SIZE 5           // number of employees to process
#define STD_HOURS 40.0   // normal work week hours before overtime
#define OT_RATE 1.5      // time and half overtime setting

int main()
{
    // Declare arrays and variables
    long int clockNumber[SIZE] = {98401, 526488, 765349, 34645, 127615}; // Employee clock numbers
    float wageRate[SIZE] = {10.6, 9.75, 10.5, 12.25, 8.35};  // Hourly wage rate for each employee
    float hours[SIZE];        // Hours worked by each employee in a given week
    float normalPay[SIZE];    // Normal weekly pay (no overtime)
    float overtimeHrs[SIZE];  // Overtime hours worked in a given week
    float overtimePay[SIZE];  // Overtime pay for each employee
    float grossPay[SIZE];     // Total gross pay for each employee

    int i; // Loop variable

    // Display the program header
    printf("\n*** Pay Calculator ***\n\n");

    // Process each employee
    for (i = 0; i < SIZE; i++)
    {
        // Prompt for hours worked
        printf("Enter hours worked for Employee %ld: ", clockNumber[i]);
        scanf("%f", &hours[i]);

        // Calculate overtime hours and pay
        if (hours[i] > STD_HOURS)
        {
            overtimeHrs[i] = hours[i] - STD_HOURS;
            normalPay[i] = STD_HOURS * wageRate[i];
            overtimePay[i] = overtimeHrs[i] * wageRate[i] * OT_RATE;
        }
        else // No overtime
        {
            overtimeHrs[i] = 0;
            normalPay[i] = hours[i] * wageRate[i];
            overtimePay[i] = 0;
        }

        // Calculate gross pay (normal pay + overtime pay)
        grossPay[i] = normalPay[i] + overtimePay[i];
    }

    // Print the report header
    printf("\n--------------------------------------------------------------------------\n");
    printf("    Clock#   Wage  Hours    OT       Gross\n");
    printf("--------------------------------------------------------------------------\n");

    // Print each employee's data in the formatted table
    for (i = 0; i < SIZE; i++)
    {
        printf("%8ld   %5.2f  %5.1f   %5.1f   %8.2f\n", clockNumber[i], wageRate[i], hours[i], overtimeHrs[i], grossPay[i]);
    }

    return 0;
}