Let n be the number of nickels and q be the number of quarters in the jar.
Worth of each nickle is $0.05 and worth of each quarter is $0.25. So worth of n nickles will be 0.05n and worth of q quarters will be 0.25q.
There are 150 total coins in the jar. So we can write the equation as:
n + q = 150 (Equation 1)
Total value of coins is $26.70. So we can write the equation as:
0.05n + 0.25q = 26.70 (Equation 2)
From Equation 1 value of n comes out to be n = 150 - q. Using this value in Equation 2, we get:

Using the value of q in Equation 1, we get the value of n to be 54.
This means, John has 54 nickles and 96 quarters in the jar.