Let x be the number of dimes collected and y be the number of nickels collected, then we can set the following system of equations:

Substituting the second equation in the first one, and solving for y we get:

Substituting y=128 in the second equation we get:

Answer: They collected 640 dimes and 128 nickels.