Project 28: Binomialpdf

Binomial Explanation: Suppose you have a 30% chance of winning a certain game of chance every time you play it.  Suppose you decide to play the game 3 times.  We are concerned with the number of games you would win.  Let's call the number of games you would win X.

Project 28: Variables 'n', 'p', and 'k' have been initialized.  There is also a working method called combinations.

n is the number of trials (10 in the last example)

p is the probability of success on every trial (.2 in the last example)

k is the number of successes that we are trying to calculate the probability of (3 in the last example)

combinations(n,k) returns how many ways to choose k elements from n elements

examples: combinations(3, 1) = 3

                       combinations(10, 3) = 120

Task: Appropriately assign the value of the variable 'binompdf' that represents the probability of getting k successes out of n trials (with p as the probability of success on every trial).

**If your code works for 5 test cases, you can enter your e-mail address

Universal Computational Math Methods:

pow(5,2) returns 25.0

abs(-3.0) returns 3

sqrt(49.0) returns 7.0