//*******************************************************
//
// Assignment 3 - Conditionals
//
// Name: Fisher Brown
//
// Class: C Programming, Spring 2025
//
// Date: February 16, 2025
//
// Description: Program which determines overtime and 
// gross pay for a set of employees with outputs sent 
// to standard output (the screen).
//
//********************************************************

#include <stdio.h>

// Declare constants 
#define STD_HOURS 40.0
#define NUM_EMPLOYEES 5
#define OT_RATE 1.5  // Overtime pay multiplier

int main() 
{  
    int clockNumber;     // Employee clock number
    float wageRate;      // Hourly wage for an employee
    float hours;         // Total hours worked in a week
    float normalPay;     // Standard weekly normal pay (without overtime)
    float overtimeHrs;   // Overtime hours worked beyond 40
    float overtimePay;   // Overtime pay amount
    float grossPay;      // Total weekly gross pay (normal + overtime)

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

    // Process each employee
    for (int i = 0; i < NUM_EMPLOYEES; i++) {
        
        // Prompt the user for input
        printf("\nEnter clock number: ");
        scanf("%d", &clockNumber);

        printf("Enter wage rate: ");
        scanf("%f", &wageRate);

        printf("Enter number of hours worked: ");
        scanf("%f", &hours);
        
        // Initialize variables
        overtimeHrs = 0;
        overtimePay = 0;
        normalPay = wageRate * hours;

        // Calculate overtime if hours exceed 40
        if (hours > STD_HOURS) {
            overtimeHrs = hours - STD_HOURS;
            overtimePay = (wageRate * OT_RATE) * overtimeHrs;
            normalPay = wageRate * STD_HOURS;  // Cap normal pay at 40 hours
        }

        // Calculate total gross pay
        grossPay = normalPay + overtimePay;

        // Print the employee's payroll information
        printf("\n------------------------------------------------");
        printf("\nClock#   Wage  Hours   OT    Gross");
        printf("\n------------------------------------------------");
        printf("\n%06d  %5.2f  %5.1f  %5.1f  %8.2f\n", 
                clockNumber, wageRate, hours, overtimeHrs, grossPay);
    }
    
    return 0;
}