I JUST NEED HELP ON THE WRITING THE FUNCTION PART.
write a function called calculatePay( ) which takes an employee as an argument and returns the amount of money they need to be paid this pay period. Employees should be paid "time and a half" for all hours over 40. You should set values for the employee's hours and payRate before sending it to the function.
Not sure if this is the cause of your error, but line 27 of your code, (and the same for kbw's code, line 21), is spelled wrong. It should be system("PAUSE");
double calculatePay(employee e)
{
double pay = e.hours * e.payRate;
//Employees should be paid "time and a half" for all hours over 40
//that can be read as «they have a .5 bonus»
constdouble work_limit = 40; //some day this will be reduced
double extra_hours = e.hours - work_limit;
if(extra_hours > 0)
pay += extra_hours * 0.5 * e.payRate;
return pay;
}
Where is this company located. I would work for them since they pay over $1000 more than they should for 15 hours of overtime. And even for 40 hours or less it is twice what it should be.