Electrical and Computer Engineering
12
UAH
CPE 112
Payroll Program (continued)
•//*****************************************************
•
•void CalcPay(/* in */ float payRate, // Employee’s pay rate
•             /* in */ float hours, // Hours worked
•             /* out */ float& wages) // Wages earned
•
•// CalcPay computes wages from the employee’s pay rate
•// and the hours worked, taking overtime into account
•
•{
• if (hours > MAX_HOURS; // Is there overtime?
•      wages = (MAX_HOURS * payRate) + // Yes
•                (hours – MAX_HOURS) * payRate * OVERTIME;
• else
•      wages = hours * payRate; // No
•}