If you want the algebraic way of doing it, let's say the following:
Price of a melon = M
Price of a lemon = L
Amount of cash = C
C=6M+7L (first equation)
C=8M+4L
6M+7L=8M+4L
Subtract 6M from both sides:
7L=2M+4L
Subtract 4L from both sides:
3L=2M
Substitute back into the first equation:
C=9L+7L
So Jill can buy 16 lemons, with no change.