For Beth, we know that she works 5 days a week and that she earns $54 dollars per day. Next, add the $10 dollars for each extra hour of work. p stands for the amount she gets paid.
(54 * 5) + (10 * x) = p
For Ray, do exactly the same things you did for Beth but put in his earnings.
(60 * 5) + (8 * x) = p