Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2008-03-29 13:54:39

cadjeff
Member
Registered: 2007-05-08
Posts: 26

Argh! can anybody help?! Problem solving ... VBA visual basic, macros

Hello all,

before you read on, if you can't help or you don't have time...if you know of any sources where i may be able to find help that would be greatly appreciated.

i'm supposed to be doing this problem using Visual Basic, macros etc... except we were given two pathetic lectures on using it. I've never used it before and we've been taught virtually no suitable language for it. I've been looking on the internet and at the library for information, but it's just not enough and i'm at a complete stand still.
I know what i want visual basic to do roughly (i think) and i;ve written it after the question....anyway here's the question itself....

A brewery has 100 barrels of beer. It's been said that a small number of the barrels have been purposely contaminated with a deadly bacteria.
Unfortunately the owner is going to trick their workers into sampling the beer (from one or more barrels). For every worker who takes a sample/s the owner will pay £100 to the family of that worker.
A testing regime needs to be put in place that will minimise the cost whilst taking in account the collateral damage. An estimate of the cost (in money and lives) is required. Confidence intervals are needed for the estimates. Include the VBA programme you develop.

Because of the hugh lack of time that's been devoted to teaching us Visual basic and how it works.....i'm basically clueless.
But from what i've seen on the internet and in books, it looks to me that i'll porbably need to use IF statements and LOOPS most of the time.

This is my own untuitive outlook on the problem.

i = number of barrels

p = number of poisoned barrels  (i don't whether or not to leave this as p or make up a value, or does it not matter?)

n = number of workers used

Probability that a worker will sample a poisoned barrel would be p/i

So i thinking i need to make some sort of command (but in visual basic language) like...

Sub barrel()
i = 100
p = 10      (for example)
n = 1
First sample taken
If poisonous Then
i = i - 1
p = p - 1
n = n + 1
If not poisonous Then
i = i - 1
LOOP


.....i don't know if i'm anyway near going in the right direction, the commands obviously need translating to VBA language. I'm not altogether sure how to work between excel and VBA either.
I just really need help if anyone could be of assistance i would be very appreciative.....THANK YOU!!!

cadd

Offline

#2 2008-03-29 17:18:56

John E. Franklin
Member
Registered: 2005-08-29
Posts: 3,588

Re: Argh! can anybody help?! Problem solving ... VBA visual basic, macros

Irradiate the beer with high levels of ionizing radiation.
Then discard all of it.


igloo myrtilles fourmis

Offline

#3 2008-03-30 14:54:14

integer
Member
Registered: 2008-02-21
Posts: 79

Re: Argh! can anybody help?! Problem solving ... VBA visual basic, macros

Since the exact number of poisoned barrels is unknown, ALL will have to be tested.

If you have 100 employees each take a sample, then the employer will automatically
be out 100 * 100 or 10,000 pounds.

It does not state what the additional cost of a dead worker might be.  Just the cost
for doing the samples, whether poisoned or not poisoned.


This appears to be your method:

Simply, have ONLY ONE employee take a sample from each barrel in sequence.
Until, unfortunaltely, she gets the contaminated batch. There goes 100 big ones.

Get the next employee & start the procedure with the remaining barrels.

At the end, the employer will have found p (the number of poisoned barrels) and it
will have cost p * 100 each.

You will need to determine the probabilty distribution at each step.

I do not know if you understand the normal curve, or if you are just
missing the VBA stuff.

If you can state the procedure in simple language, then the
algorithm can be translated to VBA (or any programming language).

Offline

Board footer

Powered by FluxBB