### Question:
CustomerLocationPDF implements ProbabilityDensityFunction<Location> { public double probability(Location record) { if(!this.pdf.containsKey(record)) return 0.0; return this.pdf.get(record); } CustomerLocationPDF(List<Location> zipcodes, Store store, double averageDistance); double probability(Location record);  }### Answer:
@Test public void testProbability() throws Exception { List<Location> zipcodes = Arrays.asList(new Location[] { new Location("11111", Pair.of(1.0, 1.0), "AZ", "Tempte", 30000.0, 100), new Location("22222", Pair.of(2.0, 2.0), "AZ", "Phoenix", 45000.0, 200), new Location("33333", Pair.of(3.0, 3.0), "AZ", "Flagstaff", 60000.0, 300) }); List<Store> stores = new ArrayList<Store>(); for(int i = 0; i < zipcodes.size(); i++) { Store store = new Store(i, "Store_" + i, zipcodes.get(i)); stores.add(store); } CustomerLocationPDF customerLocationPDF = new CustomerLocationPDF(zipcodes, stores.get(0), Constants.AVERAGE_CUSTOMER_STORE_DISTANCE); double prob = customerLocationPDF.probability(zipcodes.get(0)); assertTrue(prob > 0.0); }