Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Use visual basic to perform the following tasks: Create a procedure which does t

ID: 3931375 • Letter: U

Question

Use visual basic to perform the following tasks: Create a procedure which does the following: Clears the content of the current worksheet. Randomly generate 10 numbers between 1 and 10. Finds the mean and standard deviation of the numbers generated and stores them as variables. Create a procedure which does the following: Generates 10 random numbers from the Normal distribution using the mean and standard deviation found in part (a). Use the Application object and the Rnd() VBA function to generate the random numbers. Graph the data generated in part (a) and the Normal random variables using a Line chart. Create a procedure which does the following: Generates 10 random numbers from the Exponential distribution using the mean found in part (a). Use the Application object and the Log() and Rnd() functions to generate the random numbers. Graph the data generated in part (a) and the Exponential random variables using a Line chart.

Explanation / Answer

25)

a. (i) CODE:

a (ii) CODE:

a (iii) CODE:

Function Mean(k As Long, Arr() As Single)
     Dim Sum As Single
     Dim i As Integer


     Sum = 0
     For i = 1 To k
         Sum = Sum + Arr(i)
     Next i

     Mean = Sum / k


End Function

STANDARD DEVIATION:

Function StdDev(k As Long, Arr() As Single)
     Dim i As Integer
     Dim avg As Single, SumSq As Single

     avg = Mean(k, Arr)
     For i = 1 To k
          SumSq = SumSq + (Arr(i) - avg) ^ 2
     Next i

     StdDev = Sqr(SumSq / (k - 1))


End Function

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote