This is a problem with mathmatics. the Question is: Federal law requires hourly employees be paid "time-and-a-half" for work in excess of 40 hours in a week. For example, if a person's hourly wage is $8 and he works 60 hours in a week, his gross pay should be

(40 * 8) + (1.5 * 8 * (60-40)) = $560

below is my formula:
egularwages = hoursworked * wages
grosspay = hoursworked * wages + (1.5 * wages * (hoursworked - hoursworked))
If wages <= 40 Then
txtGrossPay.Text = (regularwages * hoursworked)
ElseIf wages >= 40 Then
txtGrossPay.Text = (regularwages * hoursworked + (1.5 * wages * (wages - regularwages)))
End If
Please help by telling me what I have wrong? Thanks..

egularwages = hoursworked * wages

I assume there is an "r" in front of that? It should say regularwages?

"grosspay = hoursworked * wages + (1.5 * wages * (hoursworked - hoursworked)) "

hoursworked - hoursworked will always be zero.

I would start your if statement before this.
If hoursworked < = 40 then
grosspay = hoursworked * wages

Eslseif hoursworked > 40 (note: not greater than or equal to)
grosspay = (hoursworked * wages) + ((hoursworked - 40) * .5 * wages)
End if

I'd try something like that. See if it works better. Not sure of exact programming terms since it has been years, but think the idea is easier and more organized.

this technique didn't work, I keep getting double results.

The idea of Matts is sound, but if it was not implemented correctly, depending on the syntax of the language you are using, it may not work. Either you implement the following algorithm, or you post what you have done (code). Either way, we'd be in a better position to check things out.

OTrate=1.5 // rate of OT
threshold=40 // hours before OT kicks in
pay = hoursworked * wages
if (hoursworked>40) then
pay=pay+(hoursworked-threshold)*wages*(OTrate-1)
endif

Thank you so much for your help. I was able to get it to work. I had to remove txt statements and just assign grosspay and make one txt statement after end if. Otherwise Matt was correct. Thanks everyone, you were very helpful....

There are a few issues with your formula. Let's go through them step by step:

1. In the line `grosspay = hoursworked * wages + (1.5 * wages * (hoursworked - hoursworked))`, the expression `(hoursworked - hoursworked)` will always evaluate to zero. This part of the formula should calculate the number of hours worked in excess of 40, so instead of `(hoursworked - hoursworked)`, it should be `(hoursworked - 40)`.
Revised formula: `grosspay = hoursworked * wages + (1.5 * wages * (hoursworked - 40))`

2. In the `If` statement, the condition `wages <= 40` is incorrect. The condition should check if `hoursworked <= 40` since we want to compare the number of hours worked, not the wages.
Revised formula: `If hoursworked <= 40 Then`

3. In both the `If` and `ElseIf` blocks, you are using the variable `regularwages` which is not defined in your code. I believe you intended to use the variable `wages` instead.
Revised formula (inside `If` block): `txtGrossPay.Text = (wages * hoursworked)`

4. In the `ElseIf` block, the expression `(wages - regularwages)` is incorrect. This part of the formula should calculate the number of hours worked in excess of 40, so instead of `(wages - regularwages)`, it should be `(hoursworked - 40)`.
Revised formula (inside `ElseIf` block): `txtGrossPay.Text = (wages * hoursworked + (1.5 * wages * (hoursworked - 40)))`

Here's the modified code:

```
regularwages = hoursworked * wages
If hoursworked <= 40 Then
txtGrossPay.Text = (wages * hoursworked)
ElseIf hoursworked > 40 Then
txtGrossPay.Text = (wages * hoursworked + (1.5 * wages * (hoursworked - 40)))
End If
```

Make sure to replace `regularwages` with `wages` throughout your code.