Develop a C++ program that uses a while statement to determine the gross pay for each of
several employees. The company pays 10 RM per hour for the first 40 hours worked by
each employee and pays 20 RM per hour for all hours worked in excess of 40 hours. Your
program should determine and display the employee’s gross pay when information on
number of hours worked is given.
[Hint: use while loop for repetition. Input value -1 for hours worked, to end the repetition].
Sample of output:
Enter hours worked (-1 to end): 39
Salary is RM 390
Enter hours worked (-1 to end): 40
Salary is RM 400.00
Enter hours worked (-1 to end): 41
Salary is RM 415.00
Enter hours worked (-1 to end): -1
Prompt the user for the hours worked for an employee
Input the hours worked for the first employee
While the value (-1) has not been entered for the hours
If the hours input is less than or equal to 40
Calculate gross pay by multiplying hours worked by hourly rate
Calculate gross pay by multiplying hours worked above forty by 2 times the hourly rate
and adding 40 hours worked by the hourly rate
Display the employee’s gross pay.
Input the hours worked for the next employee