public void calculateMonthInterestRate() { Integer fee = type.getFee(); Double interestRate = type.getInterestRate(); if (fee != null) { balance -= fee; if (balance < 0) frozen = true; } else if (interestRate != null) balance *= (1 + interestRate); }
public Account( int accountNum, int initialDeposit, Branch branch, CustomerInfo customerInfo, AccountType type) { if (type.getInitialDeposit() > initialDeposit) throw new IllegalArgumentException("initial deposit is too small"); if (customerInfo == null) throw new IllegalArgumentException("customerInfo should be passed"); this.accountNum = accountNum; this.balance = initialDeposit; this.branch = branch; this.customerInfo = customerInfo; this.type = type; this.frozen = false; this.transactions = new LinkedList<>(); }