### Question:
User implements IUser { public double getCharge() { double result = 0.0d; for (Rental rental : rentals) { result += rental.getMovie().getPriceCategory().getCharge(rental.getRentalDays()); } return result; } User(String aName, String aFirstName); int getId(); void setId(int anID); List<Rental> getRentals(); void setRentals(List<Rental> someRentals); String getName(); void setName(String aName); String getFirstName(); void setFirstName(String aFirstName); Calendar getBirthdate(); double getCharge(); @Override boolean equals(Object o); @Override int hashCode(); boolean hasRentals(); int addRental(Rental rental);  }### Answer:
@Test public void testGetCharge() { double delta=1e-6; User u = new User(NAME, FIRSTNAME); double charge = u.getCharge(); assertEquals(0.0d, charge, delta); PriceCategory regular = RegularPriceCategory.getInstance(); Movie mov = new Movie("A", regular); Rental r = new Rental(u, mov, 1); charge = r.getRentalFee(); assertEquals(charge, u.getCharge(), delta); mov = new Movie("B", regular); r = new Rental(u, mov, 1); charge += r.getRentalFee(); mov = new Movie("C", regular); r = new Rental(u, mov, 1); charge += r.getRentalFee(); assertEquals(charge, u.getCharge(), delta); }