//Answer for Part 1 public class Car { private double currentFuel; private double mpg; public Car(double c, double m) { currentFuel = c; mpg = m; } public boolean canMakeTrip(double distance) { double fuelRequired = distance / mpg; if (fuelRequired <= currentFuel) { currentFuel -= fuelRequired; return true; } else { return false; } } } //Answer for Part 2 public class TrashCan { private double capacity; private double trashAmount; public TrashCan(double weightCapacity) { capacity = weightCapacity; trashAmount = 0.0; } public double acceptTrash(double dumpWeight) { if (trashAmount + dumpWeight >= capacity) { trashAmount += dumpWeight - capacity; } else { trashAmount += dumpWeight; } return capacity – trashAmount; } }