A bag contains a number of coins: pennies, nickels, dimes and quarters.

If you pick a single coin at random from the bag, the expected value
you receive is 15 cents.

However, if an additional dime is added to the bag, then the expected
value of a single draw would decrease to 14 cents.

Let p, n, d and q be the numbers of pennies, nickels, dimes and quarters
in the bag.

Then we have two equations:

(p + 5n + 10d + 25q)/(p + n + d + q) = 15

(p + 5n + 10(d+1) + 25q)/(p + n + (d+1) + q) = 14

or...

p + 5n + 10d + 25q = 15p + 15n + 15d + 15q

p + 5n + 10d + 25q + 10 = 14p + 14n + 14d + 14q + 14

Subtracting gives:

p + n + d + q = 4

and there are four coins in the bag. By substituting into the first
equation, we get:

p + 5n + 10d + 25q = 60

Now 5 divides every term except p, so it must divide p, and since p < 5,
p must equal 0. Hence:

n + 2d + 5q = 12

Now if q = 0, then 12 = n + 2d <= 2n + 2d = 2(n + d) = 2.4 = 8, so this case
is impossible.
Similarly, if q = 1, then 7 = n + 2d <= 2(n + d) = 2.3 = 6, and this case
is also impossible.
Obviously q cannot exceed 2, so q must equal 2, and we have:

n + 2d = 2, with n + d = 2

The only possible solution is n = 2, d = 0, and we find that the
bag holds 2 nickels and 2 quarters.