Four friends Abe, Ben, Cade and Dan sang a quartet. Two of them sang tenor, one sang baritone and one sang bass, not necessarily in that order.
It is also known that:
(i) If Ben was not one of the tenors, then Abe was the baritone.
(ii) If Dan was the baritone, then Cade was the bass.
Determine the probability that:
(a) Ben was a tenor.
(b) Abe was the baritone.
(c) Cade was the bass.
DefDbl A-Z
Dim crlf$
Function mform$(x, t$)
a$ = Format$(x, t$)
If Len(a$) < Len(t$) Then a$ = Space$(Len(t$) - Len(a$)) & a$
mform$ = a$
End Function
Private Sub Form_Load()
ChDir "C:\Program Files (x86)\DevStudio\VB\projects\flooble"
Text1.Text = ""
crlf$ = Chr(13) + Chr(10)
Form1.Visible = True
DoEvents
' tenor,tenor, baritone, bass
perf$ = "abcd": h$ = perf$
Do
good = 1
If InStr(perf$, "b") > 2 And Mid$(perf$, 3, 1) <> "a" Then good = 0
If Mid(perf$, 3, 1) = "d" And Mid(perf$, 4, 1) <> "c" Then good = 0
If good Then
ct = ct + 1
Text1.Text = Text1.Text & perf$ & crlf
If InStr(perf$, "b") <= 2 Then benten = benten + 1
If Mid(perf$, 3, 1) = "a" Then abebar = abebar + 1
If Mid(perf$, 4, 1) = "c" Then cadebass = cadebass + 1
End If
permute perf$
Loop Until perf$ = h$
Text1.Text = Text1.Text & benten & "/" & ct & " =" & mform(benten / ct, " 0.00000000") & crlf
Text1.Text = Text1.Text & abebar & "/" & ct & " =" & mform(abebar / ct, " 0.00000000") & crlf
Text1.Text = Text1.Text & cadebass & "/" & ct & " =" & mform(cadebass / ct, " 0.00000000") & crlf
Text1.Text = Text1.Text & crlf & "done"
End Sub
finds the valid filling of the positions as follows (two tenor positions, the baritone position and the bass position in that order):
abcd
abdc
bacd
badc
bcad
bdac
bdca
cbad
cdab
dbac
dbca
dcab
and the following probabilities:
(a) 10/12 = 0.83333333
(b) 6/12 = 0.50000000
(c) 4/12 = 0.33333333
|
Posted by Charlie
on 2014-10-24 19:28:50 |