Function weekly_salary(hours_worked As Double, base_hourly_salary As Double) As Double
If hours_worked <= 40 Then
weekly_salary = hours_worked * base_hourly_salary
ElseIf hours_worked <= 60 Then
hours_worked = hours_worked - 40
weekly_salary = (40 * base_hourly_salary) + (hours_worked * base_hourly_salary * 1.5)
ElseIf hours_worked > 60 Then
hours_worked = hours_worked - 60
weekly_salary = (40 * base_hourly_salary) + (60 * base_hourly_salary * 1.5) + (hours_worked * base_hourly_salary * 2)
End If
End Function
Ugly, but it should do the job I think. I have assumed that if anyone works more than 80 hours, they earn double pay for the additional hours also.
posted by Touchstone at 8:06 AM on June 7, 2006