Need to use java for this problem.
a.Modify the BankAccount program as follows:
Add a name to each BankAccount
Add an account number to your BankAccount. This should be similar to the process described on page 391. Remember to increase the lastAssignedNumber.
Add a method to get the account number.
Add a method to get the name associated in the account.
Add a method to add or change the name on the account. This should be a set method.
Create a method that adds an OverDraftFee which is a static public variable, page 392-393. The overdraft fee should be $20.
Change your withdraw method to check for an overdraft and if overdraft call the method in iv.
b. Modify the BankAccount tester as follows:
Create an ArrayList to hold the BankAccounts.
Create three bankAccounts by asking the user to input the name and balance for each holder.
Add the three BankAccounts to the ArrayList.
Using the first account, deposit $100.
From that same account, create a deposit that would cause the account to overdraft.
Print the name, account, and balance for all three accounts.
The BankAccount in question is below
public class BankAccount
{
private double balance;
private int accountNumber;
private static int lastAssignedNumber = 1000;
public BankAccount()
{
// initialise instance variables
balance = 0;
}
public BankAccount(double intialBalance)
{
balance = intialBalance;
}
public void deposit(double amount)
{
// put your code here
balance = balance + amount;
}
public void withdraw(double amount)
{
balance = balance - amount;
}
public double getBalance()
{
return balance;
}
}