You are given two equations
6a + 9b = 189
a + b = 24
solve the second for a
a = 24 - b
substitute this value for a in the first equation
6(24 - b) + 9b = 189
144 - 6b + 9b = 189
3b = 45
b = 15 hours
substitute tht value back into the second equation to solve for a
a = 24 - (15) = 9
Check by substituting the two values into the first equation
6(9) + 9(15) = 189
54 + 135 = 189
which is correct.