title: Basic Java Vending Machine Program
body: <p>I am making a vending machine program and I'm not sure whats wrong</p>
  
  <p>VendingMachine.java:</p>
  
  <p>public class VendingMachine {</p>
  
  <pre><code>int canCount;
  int tokenCount;
  
  public VendingMachine()
  {
      canCount = 0;
      tokenCount = 0;
  }
  public VendingMachine(int initialCans, int initialTokens)
  {
      canCount = initialCans;
      tokenCount = initialTokens;
  }
  public void fillUp(int cans) 
      {
      canCount += cans;   
      }
  public void insertToken()
  {
      tokenCount -= tokenCount;
      canCount -= canCount;
  }
  public double getCanCount()
  {
      return canCount;
  }
  public double getTokenCount()
  {
      return tokenCount;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>VendingMachineTester.java:</p>
  
  <pre><code>public class VendingMachineTester
  {
      public static void main(String[] args)
      {
          VendingMachine machine = new VendingMachine(5, 5);
          machine.fillUp(10); // Fill up with ten cans
          machine.insertToken();
          machine.insertToken();
          System.out.print("Token count: ");
          System.out.println(machine.getTokenCount());
          System.out.println("Expected: 7");
          System.out.print("Can count: ");
          System.out.println(machine.getCanCount());
          System.out.println("Expected: 13");
      }
  }
  </code></pre>
  
  <p>When I run it it gives me this:</p>
  
  <pre class="lang-none prettyprint-override"><code>Token count: 0.0
  Expected: 7
  Can count: 0.0
  Expected: 13
  </code></pre>
  
  <p>I am just wondering why it is giving me zeros and not my expected values.
  Thanks in advance.</p>