Step 1 :Translate the problem into a system of linear equations. Let's denote the time the Foster family's sprinkler was used as x and the time the Young family's sprinkler was used as y. Then we have two equations: \(x + y = 40\) (total time) and \(15x + 35y = 900\) (total water output).
Step 2 :Solve the system of equations to find the values of x and y. The solution is \(x = 25\), \(y = 15\).
Step 3 :Final Answer: The Foster family's sprinkler was used for \(\boxed{25}\) hours and the Young family's sprinkler was used for \(\boxed{15}\) hours.