Updating a value in a method - java
<p>So in this program there are bank accounts and I'm working on a method that allows users to change their balance this is what I have: <br></p>

<pre><code>   public double modifyBalance(int accountID, double adjustment) {
     Account temp = findAccount(accountID, 0, size, lastPos);
     double currBal = temp.getBalance();    
     if (temp!= null){      
        currBal = currBal + adjustment;
     }
     else {
           System.out.println("No account found. ");
        }


     return currBal;
  }
</code></pre>

<p>the return of currBal however is not updating the actual account's balance, i tried <code>temp.getBalance() = currBal;</code> but that didn't work and gave me a compile error saying: </p>

<blockquote>
  <p>OrderedVectorOfAccounts.java:95: error: cannot find symbol<br>
         temp.getBalance = currBal;<br>
        &nbsp;&nbsp;&nbsp;    &nbsp;&nbsp; &nbsp;^
    <br>symbol:   variable getBalance<br>
    location: variable temp of type Account<br>
  1 error</p>
</blockquote>

<p>For example: If the account's balance was 200 and I "deposit" or add 200 it should be 400, but it is remaining as 200 with what I have..<br>
Any help would be great! Thanks!</p>

<p>This is my findAccount():<br><br></p>

<pre><code>public Account findAccount(int accountID, int from, int to, int [] lastPos){
     if(from &gt; to || (from+2)/2 &gt;= size)
        return null;
     while(from &lt;=to) {   
        if(accountID == theAccounts[(from+to)/2].getAccountNum())
           return theAccounts[(from + to)/2];
        else if (accountID&gt;theAccounts[(from + to)/2].getAccountNum()){
          // return findAccount(accountID, (((from + to)/2)+1), to, lastPos);
           return theAccounts[accountID-1];
        }
        else if (accountID&lt;theAccounts[(from + to)/2].getAccountNum()){
           //return findAccount(accountID, from, (((from + to)/2)-1),lastPos);
           return theAccounts[accountID-1];
        }
     }
     lastPos[0] = (from + to)/2;
     return null;
</code></pre>
