Question: this is for cs 2130 computational structures class.. Thank you for your help and expertise. ! Write a Binomial class to implement a Binomial random
this is for cs 2130 computational structures class.. Thank you for your help and expertise. !

Write a Binomial class to implement a Binomial random variable. Private instance variables for the class should include: double P-probability of a success in any one trial long N-number of independent trials long X-the number of successes in the N trials The class methods should include: appropriate constructor(s) appropriate get and set methods for the instance variables lon g randomXO - generates a new random valu e for X. double meanO calculates the mean of the random variable N*P] double varian ce0 - calculates the variance of random variable [NP-P)] double probXO - calculates the Binomial probability for the current X value Write a program that uses the Binomial class to solve the following problems: 1. For the Binomial distribution defined by P-0.36 and N-22: a. b. c. d. Output Pand N Generate a random value for X, and then output that value Output the mean of the distributi on Output the variance of the distribution 2. For the Binomial distribution defined by P-0.73 and N 6, output the probability distri bution of X. That is, for each value of X from 0 to 6, show the X-value together with the probability for that value. Output form at should be: Pr (X) 1 3. For the Binomial distributi on defined by P-0.32 and N- 12: a. Generate 100 random variable valu es b. Calculate the average of these generated values [ Xi +X2 +. +Xi00)/100] c. Calculate the theoretical mean of this probability distribution using the mean ) method d. Compare the values obtained in 3b and 3c. How close are they? Why aren't the values identical
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
