Hi,
I am creating a program that has tp determine the gross pay for each of several employees.
And employee receives time-and-a-half for all hours worked in excess of 40 hours.
The problem is, I just can't think of a way I can calculate this time-and-a-half. This is what iv'e come with so far -
Iv'e tried something like this - salary = (hoursWorked * hourlyRate) * 2 - but that wasn't correct.Code:int main() { double hoursWorked; // read in the hours worked by employee double hourlyRate; // read in the hourly rate of the employee double salary; // Print the gross pay of the employee cout << setprecision( 2 ) << fixed; while( hoursWorked != -1.0 ) { cout << "Enter hours worked ( -1 to end ): "; cin >> hoursWorked; if( hoursWorked != -1.0 ) { cout << "Enter hourly rate of the worker($00.00): "; cin >> hourlyRate; salary = hoursWorked * hourlyRate; if( hoursWorked < 40 ) salary = hoursWorked
Can anyone please give me hand with this?
Thank you