//
// Assignment 4 - Arrays
//
// Name: Henri Biqiku
//
// Class: C Programming, Fall 2026
//
// Date: Oct 4, 2026
//
// Description: Program which determines overtime and 
// gross pay for a set of employees with outputs sent 
// to standard output (the screen).
//
//********************************************************

#include <stdio.h>

// Constants
#define SIZE 5
#define STD_HOURS 40.0
#define OT_RATE 1.5

int main()
{
    // Unique employee identifier
    long int clockNumber[SIZE] = {
        98401, 526488, 765349, 34645, 127615
    };

    // Hourly wage for each employee
    float wageRate[SIZE] = {
        10.60, 9.75, 10.50, 12.25, 8.35
    };

    // Arrays for hours, overtime, and gross pay
    float hours[SIZE];
    float overtimeHrs[SIZE];
    float grossPay[SIZE];

    // Variables used for calculations
    float normalPay;
    float overtimePay;

    int i;

    printf("\n\t*** Pay Calculator ***\n\n");

    // Read hours and calculate overtime and gross pay
    for (i = 0; i < SIZE; i++)
    {
        printf("Enter hours worked for employee %ld: ", clockNumber[i]);
        scanf("%f", &hours[i]);

        if (hours[i] > STD_HOURS)
        {
            overtimeHrs[i] = hours[i] - STD_HOURS;

            normalPay = wageRate[i] * STD_HOURS;

            overtimePay = wageRate[i] * OT_RATE * overtimeHrs[i];

            grossPay[i] = normalPay + overtimePay;
        }
        else
        {
            overtimeHrs[i] = 0.0;

            normalPay = wageRate[i] * hours[i];

            overtimePay = 0.0;

            grossPay[i] = normalPay;
        }
    }

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

    for (i = 0; i < SIZE; i++)
    {
        printf("    %06ld  %5.2f  %5.1f  %6.1f  %10.2f\n",
               clockNumber[i],
               wageRate[i],
               hours[i],
               overtimeHrs[i],
               grossPay[i]);
    }

    printf("--------------------------------------------------------------------------\n");

    return 0;
}