---
title: "Precept 7 Problem Set"
output:
html_document:
df_print: paged
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
### Problem 1
Suppose 65% of Princeton students like World Coffee better than Hoagie Haven. We selected a random sample of 20 students, and asked them which they prefer. What is the probability that more than 18 students said "World Coffee"? Write R code to compute the actual probability.
Hint:
> We solved a very similar problem in class on April 2 with coin tosses. Each student answer can be thought of as being like a coin toss. Decide whether you want "Heads" to represent HH or WC, and then solve the problem using `pbinom`, just like we did in class.
### Problem 2
In class, we saw several ways to compute the cumulative probability for the binomial distribution: we used `pbinom`; we summed up the outputs of `dbinom`; we also generated a large sample using `rbinom`, and then computed the proportion of the generated numbers that was under a certain threshold.
#### Part 2(a)
Write a function named `MyPbinom1`, which works just like `pbinom`. You may use `dbinom` but not `rbinom` in the function you write.
#### Part 2(b)
Write a function named `MyPbinom2`, which works just like `pbinom`. You may use `rbinom` but not `dbinom` in the function you write.