//*******************************************************
//
// Assignment 3 - Conditionals
//
// Name: Seth Hin
//
// Class: C Programming, Spring 2026
//
// Date: February 10, 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>
// declared constants
#define STD_HOURS 40.0 // standard work week without overtime
#define NUM_EMPLOYEES 5 // number of emoployeees to process
#define OT_RATE 1.5 // overtime rate after 40 hours
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 ***");
// process each employee one at a time
for (int i = 0; i < NUM_EMPLOYEES; i++) {
// process each employee
printf("\n\nEnter clock number: "); scanf("%d", &clockNumber
);
// process each employee for the wage rate
printf("\nEnter wage rate: ");
// process each employee for number of hours worked
printf("\nEnter number of hours worked: ");
// initialize values
overtimePay = 0.0;
overtimeHrs = 0.0;
normalPay = 0.0;
// Calculate the overtime hours, normal pay, and overtime pay
if (hours > STD_HOURS) {
overtimeHrs = hours - STD_HOURS;
normalPay = wageRate * STD_HOURS;
overtimePay = (OT_RATE * wageRate) * overtimeHrs;
}
else // no overtime
{
normalPay = wageRate * hours;
}
// Calculate the gross pay with normal pay and any additional overtime pay
grossPay = normalPay + overtimePay;
// Print out information on the current employee(s)
printf("\n\nClock# Wage Hours OT Gross\n"); printf("------------------------------------------------\n"); printf("%06d %5.2f %5.1f %5.1f %8.2f\n", clockNumber, wageRate, hours, overtimeHrs, grossPay);
} // end of for loop
return 0;
}