title: How to call a method multiple times to change a variable?
body: <p>I am trying to call an <code>accelerate</code> method on a <code>speed</code> variable that adds 5 to the <code>speed</code> variable each time it is called. I'm able to do it once in the constructor:</p>
  
  <pre><code>public int getAccelerate() {
      accelerate = (speed + 5);
      return accelerate;
  }
  </code></pre>
  
  <p>and display it using</p>
  
  <pre><code>System.out.println(car1.getAccelerate());
  </code></pre>
  
  <p>but that only works once, which displays 105 if the speed variable is 100. </p>
  
  <p>My question is: how do I update the speed variable each time the <code>accelerate</code> method is called to reflect the new speed value? </p>
  
  <p>Calling it 5 times gives me the output</p>
  
  <blockquote>
    <p>105<br>
    105<br>
    105<br>
    105<br>
    105</p>
  </blockquote>
  
  <p>where I am trying to get the output</p>
  
  <blockquote>
    <p>105<br>
    110<br>
    115<br>
    120<br>
    125</p>
  </blockquote>
  
  <p>by calling the <em>same</em> method 5 times.</p>