title: Calculating interest in objective c?
body: <p>What is a simple piece of code to read a stored number, calculate interest on the stored value, say $100, at a rate of %10. Then I store the new value in place of the old one. I was working towards this:</p>
  
  <pre><code>NSNumber *bankTemp = [[NSNumber alloc] initWithInt:[[NSUserDefaults standardUserDefaults] integerForKey:@"bank"]];  
  bankTemp = bankTemp + (bankTemp * .10);
  [[NSUserDefaults standardUserDefaults] setInteger:bankTemp forKey:@"bank"];
  </code></pre>
  
  <p><code>bankTemp</code> would be the $100. I am fairly certain that I'm doing something wrong in the middle line. What can I do to correct it?</p>
  
  <p>EDIT: This is NOT homework. I'm working on a trading game app. </p>
  
  <p>EDIT:</p>
  
  <p>I've gotten this far now:</p>
  
  <pre><code>        NSNumber *bankTemp = [[NSNumber alloc] initWithInt:[[NSUserDefaults standardUserDefaults] integerForKey:@"bank"]];  
          bankTemp = [bankTemp intValue] * 1.10;
          [[NSUserDefaults standardUserDefaults] setInteger:[bankTemp intValue] forKey:@"bank"];
  </code></pre>
  
  <p>EDIT: </p>
  
  <p>To deal with cents, I'm... omitting them! </p>
  
  <p>The game does not need them so they are not worth the trouble. integers it is.</p>
  
  <p>I am curious to see what solutions people have to dealing with cents though, so please continue to post your thoughts on cents.</p>