Hi, So im trying to create a deposit method, but to no success. Can someone pls help me ??
This is my code for far:
static void depositCurrent (ArrayList<Current> CurrentListIn)
{
System.out.println ("Enter account number you want to deposit money into");
String accountNumber = EasyScanner.nextString();
boolean flag = false;
double getBalance;
String getID;
String getType;
String getHID;
String getCID;
String getName;
for (Current item : CurrentListIn)
{
getID = item.getAccountNumber();
getBalance = item.getAccountBalance();
getType = item.getAccountType();
getHID = item.getAccountHolderID();
getCID = item.getAccountClerkID();
getName = item.getAccountHolderName();
if (accountNumber.equals (getID))
{
System.out.println ("Enter amount to deposit: ");
double amountIn = EasyScanner.nextDouble();
getBalance = getBalance+amountIn;
System.out.println ("your new balance is: " + getBalance);
flag = true;
int spot = CurrentListIn.indexOf (new Current (getID, getType, getHID, getName, getCID,getBalance));
}
CurrentListIn.add(new Current (getID, getType, getHID, getName, getCID,getBalance));
}
if (flag == false)
{
System.out.println ("id " +accountNumber+ "(m) is not found");
}