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: 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.
A: 
I have $3$ pieces of candy to place in $4$ lunch boxes.  In how many ways can I do this if the candies are all the same and the lunch boxes are all different?

Method 1:  You have correctly identified the possible cases:


*

*Three candies are placed in a single box:  There are four ways to choose the box.

*Two candies are placed in one box and the third candy is placed in a different box:  There are $4$ ways to select the box which will receive two candies and three ways to choose which of the remaining boxes will receive the remaining candy.  Hence, there are $4 \cdot 3 = 12$ such distributions.

*One candy is placed in each of three boxes:  There are four ways to select the empty box.


Hence, there are a total of $4 + 12 + 4 = 20$ such distributions.
Method 2:  Let $x_k$ be the number of candies placed in the $k$th box.  Then 
$$x_1 + x_2 + x_3 + x_4 = 3 \tag{1}$$
Equation 1 is an equation in the nonnegative integers.  A particular solution of equation 1 corresponds to the placement of three addition signs in a row of three ones.  For instance,
$$1 + + 1 1 +$$
corresponds to the solution $x_1 = 1$, $x_2 = 0$, $x_3 = 2$, $x_4 = 0$.  The number of such solutions is
$$\binom{3 + 3}{3} = \binom{6}{3} = 20$$
since we must choose which three of the six positions required for three ones and three addition signs will be filled with addition signs.
A: Divide and conquer, and you are already almost there.  For 2-1-0-0, there are four places the two candies could go.  For each of these possibilities, there are three places the remaining candy could go.  For your 1-1-1-0 situation, think of this in terms of which box gets no candies.  
A: 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.
