Hi guys, i have been able to get this transfer function to work but only with one account. i'm not too sure how to get it working for the other account also. Any help would be greatly appreciated.
static String doTransfer(String amount){
// Withdraw cash -- called from ATMWithdrawl
String newBalance = "";
String newBalance1 = "";
// Turn Strings to doubles for arithmatic
double transferAmount=
(new Double(amount)).doubleValue();
double currentBalance=
(new Double(account_inf[0][4])).doubleValue();
double currentBalance1=
(new Double(account_inf[1][4])).doubleValue();
// Get the new balance as a string & update the account_inf array
if (transferAmount <= currentBalance) {
newBalance = Double.toString
(currentBalance - transferAmount);
account_inf[0][4] = newBalance;
newBalance1 = Double.toString
(currentBalance + transferAmount);
account_inf[1][4] = newBalance1;
}
else if (transferAmount <= currentBalance1) {
newBalance1 = Double.toString
(currentBalance1 - transferAmount);
account_inf[1][4] = newBalance;
newBalance = Double.toString
(currentBalance1 + transferAmount);
account_inf[0][4] = newBalance1;
}
return newBalance;
}
I'm putting the problem down to not being able to use more than 1 return statement?