An electronics company produces devices that work properly 95% of the time An electronics company produces devices that work properly 95% of the time. The new devices are shipped in boxes of 400. The company wants to guarantee that k or more devices per box work. What is the largest k so that at least 95% of the boxes meet the warranty?
Attempt:
I know I should use the Central Limit Theorem for this problem, but not sure what N should be in the setup since there are 400 devices in each box and the number of boxes are unknown. Could anyone give me a hint on the setup? Thanks!
 A: "At least" from "at least 95%" means "min".
Code:
#reproducible
set.seed(250048)

#how many times to check
N_repeats <- 500000

#stage for loop
temp <- numeric()

#loop
for (j in 1:N_repeats){

     #draw 400 samples at 95% rate
     y <- rbinom(n = 400,size = 1,prob = 0.95)

     #compute and store sampled rate
     temp[j] <- mean(y)

}

#print summary (includes min)
summary(temp)

Results:
> summary(temp)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
 0.8900  0.9425  0.9500  0.9500  0.9575  0.9925

When I look at this, I see that the minimum value for the rate is 89%.  This means that in half a million tries, the worst case was 89% working.  
89% of 400 is 356.  This gives about 100%, not 95%.  It is likely that actual 100% is lower than this.
#find the 95% case
quantile(temp,probs = 0.05)

yields:
> quantile(temp,probs = 0.05)
    5% 
0.9325 

93.25% of 400 is 373.  This is not an edge of the data, but interior, so it is likely a good estimate.  Your answer is going to be close to 373. 
A: You have to assume the devices in any box are independent.  When that is the case, the number of working devices in any box must follow a Binomial distribution.  The parameters are $400$ (the number of devices in the box) and $.95$ (the working rate).
Suppose you guarantee $k$ or more devices per box work.  You are saying that at least 95% of all such boxes contain $k$ or more working devices.  In the language of random variables and distributions, you are asserting that the chance of a Binomial$(400, 0.95)$ variable equaling or exceeding $k$ is at least $95\%$.  The solution is found by computing the $100-95$ = fifth percentile of this distribution.  The only delicate part is that since this is a discrete distribution, we should take some care not to be one off in our answer.
R tells us the fifth percentile is $k=373$:
qbinom(.05, 400, .95)


373

Let's check by computing the chance of equaling or exceeding this value:
pbinom(373-1, 400, .95, lower.tail=FALSE)


0.9520076

(Somewhat counter-intuitively, for me at least, is that the lower.tail=FALSE argument of R's pbinom function does not include the value of its argument.  Thus, pbinom(k,n,p,lower.tail=FALSE) computes the chance associated with an outcome strictly greater than k.)
As a double-check, let's confirm that we cannot guarantee even a larger value: 
pbinom(373, 400, .95, lower.tail=FALSE)


0.9273511

Thus, the threshold of $0.95$ falls between these two successive probabilities.
In other words, we have found that

In the long run $95.2\%$ of the boxes will contain $k=373$ or more working devices, but only $92.7\%$ of them will contain $374$ or more working devices.  Therefore we should not guarantee any more than $373$ if we want $95\%$ or more of the boxes to meet this standard.

Incidentally, a Normal distribution turns out to be an excellent approximation for this particular question.  (Rather than display the answer you would get, I will leave it to you to do the calculation, since you requested information only on how to set up the problem.)
This plot compares the Binomial distribution function to its approximating Normal probability.

The two don't perfectly agree--but near $k=373$ they are very close indeed. 
