package banking; /*CHECKING $25 Minimum deposit to open $12 Monthly Service Fee Waived if a) minimum daily balance $25 b) deposits totalling $500 Free deposits & withdrawals */ public class CheckingAccount extends BankAccount { //Class Constants public static final double MONTHLY_SERVICE_CHARGE= 12.0; public static final double MINIMUM_DAILY_BALANCE = 500.0; public static final double MINIMUM_DEPOSIT_TOTAL = 500.0; //Instance Variable: Total of Deposits in Billing Cycle private double totalDeposits; //Constructor public CheckingAccount(double startBalance) { super(startBalance); this.totalDeposits = 0.0; } //Accessor public double getTotalDeposits() { return this.totalDeposits; } //Override public String toString() { return super.toString() + " Total Deposits: $" + totalDeposits; } //Override public boolean equals(Object other) { if ( !super.equals(other) ) return false; return this.totalDeposits == ( (CheckingAccount)other ).totalDeposits; } //Required implementation specified by superclass public double minimumBalance() { return this.MINIMUM_DAILY_BALANCE; } public double serviceCharge() { return this.MONTHLY_SERVICE_CHARGE; } public boolean feeWaived() { return this.totalDeposits >= this.MINIMUM_DEPOSIT_TOTAL; } //Mutator Override public void deposit(double amount) { super.deposit(amount); this.totalDeposits += amount; } //Mutator Override public void billingCycle() { super.billingCycle(); //Debit Service Fee (if applicable) this.totalDeposits = 0.0; //Clear account profile flags/data } }