package bankAccount; import java.time.LocalDateTime; public class CheckDeposit extends Deposit { double amount; /** * Creates a CheckDeposit. If date is less than or equal to today's date, the deposit is available * in afterAvailable hours. If the date is in the future, the deposit will be available as of * that future date */ public CheckDeposit(double amount, LocalDateTime date, int availableAfter) { super(); this.amount = amount; LocalDateTime now = LocalDateTime.now(); if (date.getYear() < now.getYear() && date.getMonth().getValue() < now.getMonth().getValue() && date.getDayOfMonth() < now.getDayOfMonth()) { // BUG now.plusHours(availableAfter); } else { availableTime = LocalDateTime.of(date.getYear(), date.getMonth(), date.getDayOfMonth(), availableAfter, 0); } } /** * Returns the total amount of this CheckDeposit */ public double getAmount() { return amount; } }