Wednesday, January 27, 2010

More complicated math

Here's one that is considerably more complicated. This calculates average monthly employment income. Do not worry about this. You won't have to do anything this complicated, or even any math at all. I just wanted to show you that this exists. My explanations follow the // in the second version:

0
REPEAT jobcount
IF(Income frequency TE = "Weekly")
SET Income multiplier NU TO 4.333
END IF
IF(Income frequency TE = "Biweekly")
SET Income multiplier NU TO 2.167
END IF
IF(Income frequency TE = "Monthly")
SET Income multiplier NU TO 1
END IF
SET Job pay NU TO (Income multiplier NU) * (Seasonal job months per year NU / 12) * (Pay NU)
RESULT + Job pay NU
END REPEAT
TRUNCATE (RESULT, 2)


0 // the zero at the start tells HotDocs this is a math variable
REPEAT jobcount // We won't worry about this, but this is a loop for multiple jobs
IF(Income frequency TE = "Weekly") // a previous question asked "how often do you get paid?"
SET Income multiplier NU TO 4.333 // We use 4.33 because most months do not really have 28 days
END IF
IF(Income frequency TE = "Biweekly")
SET Income multiplier NU TO 2.167
END IF
IF(Income frequency TE = "Monthly")
SET Income multiplier NU TO 1
END IF
SET Job pay NU TO (Income multiplier NU) * (Seasonal job months per year NU / 12) * (Pay NU)
RESULT + Job pay NU
END REPEAT
TRUNCATE (RESULT, 2)
// An earlier question also asked about seasonal jobs. To get an average monthly pay, we multiply the monthly pay when the person is actually working by the number of months worked. i.e. - A job that brings in $6000 a month six months out of the year averages out to $3000 a month over a full year.
// TRUNCATE (RESULT, 2) This rounds the result off at two decimal points because we are talking about dollars and cents. You can truncate to any number of decimal points.

No comments:

Post a Comment