Mike has 4 times as many nickels as dimes. How many of each does he have if he has a total of $2.40

There might be an easier way but here how I did it.

4x(.05)+.10x=2.40
.2x+.10x=2.40
.3x=2.40
divide both sides by .3
x=8
so ther are 8 dimes and 32 nickels