The main question was "A machine produces 2mm to 12mm usb sticks. Any usb greater than 10mm in size will need to be thrown away."
Part A) Calculate the portion that needs to be thrown away, and I got 1/5 or 20%.
Part B) Simulate 50 memory sticks and draw a histogram. I did this in Java by getting a random number between 2 and 12, 50 times. Here are the results:
Length 2: 4 USBs
Length 3: 4 USBs
Length 4: 7 USBs
Length 5: 4 USBs
Length 6: 5 USBs
Length 7: 7 USBs
Length 8: 6 USBs
Length 9: 5 USBs
Length 10: 4 USBs
Length 11:2 USBs
Length 12: 2 USBs
Part C) Calculate the mean and variance. This is where I'm stuck because I don't know how to compute that from what I've found so far.
If you are supposed to simulate $n = 50$ observations from a continuous uniform distribution on the interval $(2, 12),$ then make a histogram of the 50 observations and find their mean and variance, then you could do it it R statistical software as follows:
But this is a $random$ experiment, so you will get different results every time you do it. For example, here are the mean and variance from my second try: