I have 3 pieces of candy to place in 4 lunch boxes. In how many ways can I do this if... I am a middle school student, so it would be super helpful if anyone could explain this problem with simple words. I was able to do (a) and (b), but I got stuck on (c) and onwards. 

For (c), I think there are three general cases, 3-0-0-0, 2-1-0-0, and 1-1-1-0. For 3-0-0-0, I know there would be 4 ways, because the 3 candies could go into any of the 4 boxes. I don't know how to tackle the other two cases, though. 

I have 3 pieces of candy to place in 4 lunch boxes. In how many ways can I do this if:

(a) The candies are all different and the lunch boxes are all different?

(b) The candies are all the same and the lunch boxes are all the same?

(c) The candies are all the same and the lunch boxes are all different?

(d) The candies are all different and the lunch boxes are all the same?

(e) Exactly two of the candies are the same (but the third is different) and all of the lunch boxes are different?
a) If the candies are all different, and so are the lunch boxes, then placing each candy in each box affects which outcome we get. Each candy has four lunch boxes to choose from, and there are three candies, making the number of possible choices
$4 \times 4 \times 4 = 64.$

b) If the candies are the same and the lunch boxes are the same, then the possibilities are threefold: all the candy is in one box, two candies are in one and one is in another, or all three candies are in different boxes. The total number of possibilities is
$$3.$$

c) If the candies are the same and the lunch boxes are all different, then  there are cases, which are the three possibilities from b):

i) One box holds all three candies. In this case, there are $4$ boxes to choose from.

ii) One box holds two, another holds one. In this case, we have $4$ boxes to choose from putting the two in, and $3$ remaining boxes to choose to put the remaining one in. So, in total, this gives us $12$ possibilities.

iii) Each candy lies in a different box. In that case, since the candies are all identical, this means we are just choosing a box to not contain anything. We can choose our empty boxes in $4$ ways.

In total, the number of choices are
$$4 + 12 + 4 = 20.$$

d) If the candies are different and the lunch boxes are the same, then again, we tackle this with cases:

i) The first case, with $1$ possibility, is that all three candies are in the same box.

ii) Two candies could be in one box, and one in the other. Since the candies are now different, there are $3$ ways to do this, as we have three ways to choose the lone candy.

iii) All three candies are in separate boxes. Since the boxes are indistinct, there is $1$ way to do this.

Thus, the number of ways to do this is
$$1 + 3 + 1 = 5.$$

e) We do this in two steps: choose where the different candy goes, then choose where the same candies go. Note that these processes are totally independent, in that doing one first does not change the number of ways we can do the other. By choosing the different candy to go in one of the $4$ possible boxes, the boxes become no more or less distinct than they did previously.

Then, the question becomes, how many ways can we put two identical candies in four similar boxes? The answer becomes similar to c): we use cases.

i) Both candies are in the same box. There are $4$ boxes to choose from.

ii) The candies line in different boxes. We can choose one of the $4$ boxes first to host one candy, then one of the remaining $3$ to host the other.

This produces a total of $4 + 4 \times 3 = 16$. Putting in our initial choice of box for our distinct candy, we get
$$4 \times 16 = 64$$
possibilities.
Exactly two of the candies are the same (but the third is different) and all of the lunch boxes are different?

All in 1                               4ways

2 the same  in 1 box and the odd one in another   4*3=12

2 different  in 1 box and the other in another          4*3=12

all in different boxes          4C2*2 = 6*2=12ways

4+12+12+12 = 40ways

From web 2.0 calc
BTW the answer in your last part is wrong I think so because in ii) you have to also consider the different candy.