This is a combined work problem. If James can paint the whole room in 5 hours, then he can do 1/5 of the job in an hour. Similarly, Dave can do 1/8 of the job in an hour. To find how fast they can complete the job working together, use the following equation:
1/5 + 1/8 = 1/t, where t = the total time James and Dave work on the project together
Solve this equation for t by finding the least common denominator of the two fractions on the left.