### Question:
CheatingStudents { public static double runUsingBinomial(int numberOfStudents, int numberOfYesAnswers) { int numberOfSamples = 100; UniformVertex probabilityOfCheating = new UniformVertex(0.0, 1.0); DoubleVertex pYesAnswer = probabilityOfCheating.times(0.5).plus(0.25); BinomialVertex answerTotal = new BinomialVertex(pYesAnswer, numberOfStudents); answerTotal.observe(numberOfYesAnswers); KeanuProbabilisticModel model = new KeanuProbabilisticModel(answerTotal.getConnectedGraph()); NetworkSamplesGenerator samplesGenerator = Keanu.Sampling.MetropolisHastings.withDefaultConfig() .generatePosteriorSamples(model, singletonList(probabilityOfCheating)); NetworkSamples networkSamples = samplesGenerator.dropCount(numberOfSamples / 10) .downSampleInterval(model.getLatentVariables().size()) .generate(numberOfSamples); double approximateProbabilityOfCheating = networkSamples .getDoubleTensorSamples(probabilityOfCheating) .getAverages() .scalar(); return approximateProbabilityOfCheating; }  static double runWithBernoulli(int numberOfStudents, int numberOfYesAnswers); static double runUsingBinomial(int numberOfStudents, int numberOfYesAnswers);  }### Answer:
@Test public void doesWorkWithBinomial() { double approximateProbabilityOfCheating = CheatingStudents.runUsingBinomial(numberOfStudents, numberOfYesAnswers); assertEquals(0.2, approximateProbabilityOfCheating, 0.05); }