Project 30: Binomialcdf

Suppose we want to calculate the probability that X is less 3.  We would want to add the probabilities from X = 0 to X = 2.

We could add the probabilities for X = 0, X = 1, and X = 2: .343 + .441 + .189 = .973

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

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

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

lower is the lower bound for the number of successes wanted (0 in the example above)

upper is the upper bound for the number of successes wanted (2 in the example above)

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

Task: Appropriately initialize the value for a variable called 'binomialcdf' that represents the probability that the number of successes obtained is between 'lower' and 'upper' inclusively (with n trials and p as the probability of success).

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