posted by .

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..

  • Programming -

    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.

  • Programming -

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

  • Programming -

    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

  • Programming -

    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....

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. Math-Asap

    I have another expression that I need help with. If the hours worked are less than or equal to 40 return the pay as hours worked times hourly wage. -hours*hourlywwage (this is my expression) Otherwise return the pay as the first 40 …
  2. math

    what does over time and time in a half mean?
  3. math

    amy is paid time and a half for hours worked in excess of 40 hours and double time for hours worked on sunday. If her weekly wage was $342 for working 50 hours, 4 of which were on sunday, what is her regular hourly rate?
  4. mathematics

    The basic wage earned by a truck driver for a 40 hr work week is $560.00. A)Calculate his hourly rate. Is the ans $14 per hour 2) For overtime work, the driver is paid one and a half time the basic hourly rate. B)Calculate his overtime …
  5. math

    How would I solve this; John is paid at an hourly rate of $15 and over time rate of 1.5 times his hourly rate. If john puts in w regular hours and y overtime hours in a week, what is his total wage for the week?
  6. math

    Angelo is paid double time for each hour he works over 40 hours in a week. Last week he worked 42 hours and earned $484. What is his normal hourly rate?
  7. Math

    Brad is paid time-and-a-half if he works over 40 hours in a week. one week he worked 55 hours and earned $697.50.Write and solve an equation that can be used to find Brad's regular hourly rate.
  8. Algebra

    H. If you are paid a weekly base salary of $200 plus an hourly wage of $5.00, determine an equation for finding your weekly gross pay (P) for t hours. Specify an amount between 25 and 50 hours worked for 1 week and determine your gross …
  9. Math

    When Alexa works overtime any hours over 40 hours a week she is paid 1.5 times her regular hourly rate in the week she worked 52 hours if her regular hourly rate is 6.80 what did she earn that week
  10. Maths

    Joy receives a normal hourly wage of $18.60 and time-and-a-half for any overtime. On public holidays he receives double time with a minimum of 4 hours paid. What is his wage for a week in which he works 40 normal hours, 6.5 hours overtime …

More Similar Questions