Question: Consider the following code to implement an account for a bank. public abstract class Account { private double balance; private int accountNumber; private static int
Consider the following code to implement an account for a bank. public abstract class Account { private double balance; private int accountNumber; private static int counter = 1; public Account(double balance) { this.balance = balance; this.accountNumber = computeAccountNumber(); } public int getAccountNumber() { return accountNumber; } private int computeAccountNumber() { return counter++; } public double getBalance() { return balance; } public void deposit(double amount) { balance += amount; } public void withdraw(double amount) { balance -= amount; } } a) Implement a method named transferTo() with two gparameters: account and amount to transfer amount dollars from this to account . If there is enough balance, the money is transferred and the method returns true. Otherwise, it returns false. b) Create a class called CheckingAccount that inherits from Account. Every checking account has to maintain a minimum balance, which is the same for all
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
