For this, all you have to do is create equations where all you have to do is change the x value. The equation for gym A would be 35 + 42x, where x is the number of months he has the membership, and the first number is the initial fee. The equation for gym B would be 65 + 36x, following the same rules. Now all you have to do is set both of these equations equal to each other:
65+36x=35+42x
Solving this equation results in x=5, which means that he has to have the memberships for 5 months for them to be equal. Now just plug that in to one side of the equation to get the amount he has to spend:
65+36(5) = $245
Line up the decimal points and multiply the rest like you would normally do it but drop down the decimal at the end
($16.25×40)+($16.25×1.5×3)= $650 + 73.13 = $723.13
*regular hrs *overtime hrs
**multiplying the regular wage of $16.25 times 1.5 gives you the overtime, or time and a half, rate.