Question: I need to create a test for the problem below. I already have the following functions: public static double Permutations(long N, long X) { double
I need to create a test for the problem below. I already have the following functions:
public static double Permutations(long N, long X) { double perm = 1.0; long i; for(i=N-X+1;i<=N;i++) perm=perm*(double)(i); return perm; } public static double Combinations(long N, long X) { double comb = 1.0; long i; if(X==0||X==N) return comb; if(N-X>X) { for(i=1;i<=X;i++) comb = comb*(double)(N-i+1)/(double)(i); return comb; } else{ for(i=1;i<=N-X;i++) comb = comb*(double)(N-i+1)/(double)(i); return comb; } } public static double HyperGeometric(long Np, long Xp, long N, long X) { double probX = 0.0; return((Combinations(Xp,X)*Combinations(Np-Xp,N-X))/Combinations(Np,N)); } public static double Binomial(double P, long N, long X) { double probX = 0.0; return(Combinations(N,X)*Math.pow(P,X)*Math.pow(1-P,N-X)); } public static double Poisson(double Xmean, long X) { double probX = 0.0; return(Math.exp(-Xmean)*Math.pow(Xmean,X)/(Permutations(X,X))); }
Suppose that the CS Dept at Happy Valley State College has two computer labs. Lab-A contains 50 PC's and Lab-B contains 30 PC's. Nine of the Lab-A PC's and 4 of the Lab-B PC's have been infected with spyware. A sample of PC's will be inspected to check for spyware.
a.Suppose 8 Lab-A PC's are randomly drawn. What is the probability that none of the PC's in the sample is infected?
b.Suppose 8 Lab-B PC's are randomly drawn. What is the probability that none of the PC's in the sample is infected?
c.Suppose 4 Lab-A PC's are randomly drawn, and a separate random sample of 4 Lab-B PC's is drawn. What is the probability that none of the PC's in either sample is infected?
d.Suppose that from a combined list of all 80 Lab-A and Lab-B PC's, 8 PC's are randomly drawn. What is the probability that none of the PC's in this sample is infected?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
