//*******************************************************
//
// Assignment 3 - Conditionals
//
// Name: Andrea Huskey
//
// Class: C Programming, Summer 2026
//
// Date: June 12, 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>

#define STD_HOURS 40.0  					// 40 hour work week constant
#define NUM_EMPLOYEES 5     				// Number of employees 5 constant
#define OVER_TIMERATE 1.5   				// 1.5 overtime constant
#define M_S "Tim N."		// Reviewed by Management 

int main() 
{
    
    int clockNumber;       // Employee clock number
    float grossPay;        // The weekly gross pay which is the normalPay + any overtimePay
    float hours;           // Total hours worked in a week
    float normalPay;       // Standard weekly normal pay without overtime 
    float overtimeHrs;     // Any hours worked past the normal scheduled work week
    float overtimePay;     // Additional overtime pay for any overtime hours worked
    float wageRate;        // Hourly wage for an employee

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

        printf("\nEnter wage rate: ");					// Prompt the user for the wage rate
        scanf("%f", &wageRate);

        printf("\nEnter number of hours worked: ");		// Prompt the user for the number of hours worked
        scanf("%f", &hours);

        if (hours > STD_HOURS) {										// Calculate the overtime hours, normal pay, and overtime pay
        	overtimeHrs = hours - STD_HOURS;							// Use completed hours minus constant - leaving only OT hours
        	overtimePay = ((wageRate * OVER_TIMERATE) * overtimeHrs);	// Use hourly rate *  1.5 constant then multiply only OT hours
        	normalPay = (hours - overtimeHrs) * wageRate;				// Use subtract ot hours from regular hours and multiply hourly rate - took me forever to figure out.
        	grossPay = normalPay + overtimePay;							// Multiply normal pay with Overtime pay for total my numbers were off thus the extra columns
            
        } else {
        	overtimeHrs = 0;											// else statement - zero out unnecessary hours
        	overtimePay = 0;											// else statement - zero out unnecessary hours
        	normalPay = hours * wageRate;								// restate hours to wage rate
        	grossPay = normalPay;										// restate hours to wage rate
        }               												// close if block
		
        printf("\n\nClock# Wage  Hours  OTHRS  OTPAY  NormalPay  Gross\n");									// Print header information on the current employee
        printf("---------------------------------------------------------------\n");								
        printf("%06d %5.2f %5.1f %5.1f   %5.2f  %5.2f %8.2f\n", 														// spacing and listing for print columns
                clockNumber, wageRate, hours, overtimeHrs, overtimePay, normalPay, grossPay);
    }																													// close print block
    
    return 0;
}   																													//end code