Uniform Distribution

PART B

Write the following three methods:

public int GetRandomUniform(int min, int max)

This method returns a random number from a uniform distribution between min and max.

public double GetRandomNormal(double mean, double stddev)

This method returns a random number from a normal distribution with a mean of mean and standard    deviation of stddev

public int GetBinIndex(double mini, double maxi, int numbins, double valuetobin)   This method returns the Bin Index given an input minimum of mini, input maximum of maxi,    numbins number of bins, and a value to bin of valuetobin

PART C

Include the methods created in part B to develop a Visual C# .NET program that will simulate the basic profit calculation, PT = nPv, where n follows a uniform distribution, Pv follows a normal distribution, and the user can input the number of bins and number of iterations.  The user must also input the min and max for n and the mean and standard deviation for Pv.  Finally, the user can click a button and the results will be graphed on a bar chart using the Microsoft Chart Control and the average total profit (PT) will be displayed in a textbox.  Turn in a screen shot of the resulting chart using:

1. Iterations:  10000 Bins:  5

n-min:  1

n-max:  10 

Pv-mean:  6750

Pv-stddev:    1275

2. Iterations:  10000 Bins:  10

n-min:  1

n-max:  10 

Pv-mean:  6750

Pv-stddev:    1275

3. Iterations:  10000 Bins:  10

n-min:  1

n-max:  10 

Pv-mean:  5525

Pv-stddev:    1250

That’s three screen shots.

PART D

Extend the Visual C# .NET program developed in part C to simulate the basic profit calculation, PT = nPv, where the user can select either a uniform or normal distribution for n using radio buttons and then must input the appropriate parameters (min and max if they select uniform, mean and standard deviation if they select normal) and they can similarly select either a uniform or normal distribution for Pv with appropriate parameters depending on the selection.  Of course, the user will input the number of bins and number of iterations.  Finally, the user can click a button and the results will be graphed on a bar chart using the Microsoft Chart Control and the average total profit (PT) will be displayed in a textbox.  Also include in the program any necessary input validation for all input values.  Turn in a listing of the code and a screen shot of the resulting chart using:

  1. Iterations: 10000 Bins:  5            n-min:  3       n-max:     6   Pv-mean:  3550   Pv-stddev:   1000
  2. Iterations: 10000 Bins:  10 n-mean: 7     n-stddev:  2     Pv-min:  2250       Pv-max:    4500
  3. Iterations: 10000 Bins:  10 n- mean:  10 n- stddev: 1      Pv-min:  1000       Pv-max:    3550

That’s three screen shots and a listing of the code.

Want latest solution of this assignment