title: Awk calculation for overtime pay
body: <p>For the following data, I am trying to determine what the over time total would be using an awk file. 
  (Overtime rule: if more than 40 hours worked, each hour after gets 1.5 times salary)</p>
  
  <pre><code>Natlie Attired 902-555-1234 10.40 44 
  Guy Wyre 401-555-3421 11.75 40
  </code></pre>
  
  <p>This is what I have so far</p>
  
  <pre><code>BEGIN{
       FS=" "
  }
  function total(){
      hours = awk {print $5}
      rate = awk {print $4}
      if(hours&lt;=40)
          sum=rate*hours
          return sum
      else
          sum=(hours - 40 * 1.5 * rate) + (rate*hours)
          return sum
  }
  
  {
      printf("%s %s worked %d hours, for a total pay of %.2f.\n", $1, $2,$5, total())
  }
  </code></pre>
  
  <p>What do I need to change in order for this to produce an accurate answer?</p>