To do this, it would be easiest to create variables for the different colored cars and then create an algebraic expression using them. For the white cars, I will use variable "W', for the yellow cars, I will use variable "Y".
Because we know that there are 9 times as many white cars, or 9x, we can say:
9Y + Y = 40
Simplify, and we get 10 Y = 40, so Y = 4
Answer: Y = 4
Hope this helped!! :D