Probability of getting the correct direction, given you get the same answer 
A town is composed of $2/5$ out of town couples and $3/5$ in town
  couples. If a couple is from out of town, the probability that the
  husband and wife will give you the correct directions independently is
  $3/4$. If the couple is from in town, they will always give you the
  correct direction independently of each other. Suppose you ask a
  random couple for directions. If both the husband and wife give you
  the same direction, what is the probability that this direction is
  correct?

I've done $X$ = (probability that direction is correct)/(probability they give you the same direction).
(probability that direction is correct) = $3/5 + (2/5)(3/4)(3/4) = 33/40$ 
(probability they give you the same direction) = $3/5 + (2/5)(3/4)(3/4)+(2/5)(1/4)(1/4) = 17/20$
$X = (33/40)/(17/20) = 33/34$
Does this seem correct? Have I done anything incorrectly?
 A: What you really need to know is how to check your work yourself.  One way is to simulate the situation.  I will illustrate with R commands.


*

*Initialize the simulation environment by specifying (a) a reproducible start for the random number generation (if desired) and (b) the number of cases to simulate.  Since the kinds of fractions that seem to show up have denominators less than $100$ or so, about $100^2 = 10,000$ iterations ought to be enough to discriminate between alternative answers.
set.seed(17)
n <- 1e4


*Generate couples at random with the specified probabilities.
couples <- ifelse(runif(n) < 2/5, "out of town", "in town")


*Generate opinions for husbands and wives independently.
husband <- ifelse(couples=="in town" | runif(n) < 3/4, "correct", "wrong")
wife <- ifelse(couples=="in town" | runif(n) < 3/4, "correct", "wrong")


*Check the results: find the consistent couples and compute which fraction was correct.
consistent <- husband == wife
correct <- consistent & wife == "correct"
p.hat <- sum(consistent & correct) / sum(consistent)


*Compare this to the expected value, accounting for the standard error due to the randomness in the simulation:
(p.hat - 33/34) / sqrt(33/34 * 1/34 / n)

The value of $-0.4489935$, which represents less than one-half a standard error, is evidence that $33/34$ is correct.
The few minutes needed to code and test this simulation and the 0.1 seconds needed to run it are probably worth investing in verifying your answer.
