Project 60:  Binomial Probability Distribution

Project 60: Variables 'n' and 'p' have been initialized.  There is also a working method available called binomialpdf.

n is the number of trials (3 in the example given)

p is probability of success on any trial (.3 in the example given)

binomialpdf(n,p,k) returns the probability of getting 'k' successes out of 'n' trials (if the probability of success on any trial is 'n').

binomialpdf(3, .3,1) returns .441

binomialpdf(3, .3,2) returns .189

Task: Appropriately initialize an array called 'binomialProbs'.  The array should hold the probabilities for each possible number of successes from least to greatest.

Example: If n = 3, and p = .3, the binomialProbs = [.343, .441, .189, .027].

Note:  You can assume 'binomialProbs' has been initialized as an empty array (or ArrayList if you are coding in Java)

Note: binomialProbs.push(5) would push 5 to the end of the array (JS) while binomialProbs.add(5) would add 5 to the end of the ArrayList (Java)

**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