Ask the user how much they would like to deposit into the first account and how much would they like to deposit into the second account. Update the accounts accordingly.
You must use a loop here to process the deposit for each account in the array.
How do i create a for loop that loops through the array and deposits into each account?
public class BankAccountTesting { public static void main(String[] args) { BankAccount[] account = new BankAccount[2]; account[0] = new BankAccount("12345","John Brown"); account[1] = new BankAccount("6789","Paul brown"); printAccounts(account); System.out.println("How much to deposit to Account 1 ?"); double deposit1 = EasyScanner.nextDouble(); System.out.println("How much to deposit to Account 2 ?"); double deposit2 = EasyScanner.nextDouble(); for(int i = 0 ; i < account.length ; i++){ account[i].deposit(); } printAccounts(account); } public static void printAccounts(BankAccount [] account){ for (int i = 0 ; i<2 ; i++){ System.out.println("Bank Account Details" + (i+1)); System.out.println("Account Name : " + account[i].getAccountName()); System.out.println("Account Number : " + account[i].getAccountNumber()); System.out.println("Balance : " + account[i].getBalance()); System.out.println(" ");} } }