//*******************************************************
// Assignment 3 - Conditionals
//
// Name: Carlos Dominguez
//
// Class: C Programming, Spring 2026
//
// Date: 02/09/2026 ------------------- is winter over?
//
// 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 // constant standard hours
#define NUM_EMPLOYEES 5 // constant number of employees
#define OT_RATE 1.5 // constant for overtime multiplier
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 ***");
// BEGIN employee-processing loop
// This loop repeats once for each employee and handles:
// - Input collection
// - Overtime calculation
// - Pay calculations
// - Output
// -------------------------------------------------------------
for (int i = 0; i < NUM_EMPLOYEES; i++) {
printf("\n\nEnter clock number: "); scanf("%d", &clockNumber
);
printf("\nEnter wage rate: ");
printf("\nEnter number of hours worked: ");
if (hours > STD_HOURS) {
// Calculate overtime hours and pay
overtimeHrs = hours - STD_HOURS;
normalPay = STD_HOURS * wageRate;
overtimePay = overtimeHrs * wageRate * OT_RATE;
} else {
// No overtime — all hours are normal hours
overtimeHrs = 0.0;
normalPay = hours * wageRate;
overtimePay = 0.0;
}
// Total gross pay calculation
grossPay = normalPay + overtimePay;
// Display results
printf("\n\nClock# Wage Hours overtimeHrs normalPay overtimePay Gross\n"); printf("-------------------------------------------------------------------------\n"); printf("%06d %5.2f %5.1f %5.1f %8.2f %8.2f %8.2f\n", clockNumber, wageRate, hours, overtimeHrs,
normalPay, overtimePay, grossPay);
}
//---------------------------------------------------------------------
// END employee-processing loop
return 0; // End program
}