title: format to 2 decimal places before adding to array
body: <p>Hey so I have test program for something I'm working on.</p>
  
  <p>What does it do? - It basically minuses the monthly loan payments from the total amount payable and then inserts it into an array, it is working however I need it to be formatted to 2 decimal places and I have no idea how to do that, I've tried using a method I found which is </p>
  
  <pre><code>[NSString stringWithFormat: @"%.2lf", tempPaymentHolder]
  </code></pre>
  
  <p>But it doesn't seem to work, here is the code. </p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  
  int main (int argc, const char * argv[])
  {
  
      @autoreleasepool {
  
          //array that would hold the payments
          NSMutableArray * arrayWithPayments = [[NSMutableArray alloc]init];
  
          //total amount to be paid
          NSMutableString * totalPaymentString = [[NSMutableString alloc]initWithString:@"151.92"];
  
          //monthly payment
          NSMutableString * monthlyPaymentsString = [[NSMutableString alloc]initWithString:@"12.66"];
  
          //temp storage for passing values into array
          NSMutableString * tempPaymentStringHolder = [[NSMutableString alloc]init];
          tempPaymentStringHolder = [NSString stringWithFormat:@"%@",totalPaymentString];
  
          //doubles so I can calculate
          int numberOfMonths = 12;
          double monthlyPayments = [monthlyPaymentsString doubleValue];
          double totalPayment = [totalPaymentString doubleValue];
          double tempPaymentHolder = totalPayment;
  
  
          for (int i = 0; i &lt;= numberOfMonths; i++) 
          {
              [arrayWithPayments addObject:tempPaymentStringHolder];
              tempPaymentHolder = totalPayment - monthlyPayments;
              totalPayment = tempPaymentHolder;
              tempPaymentStringHolder = [NSString stringWithFormat: @"%.2lf", tempPaymentHolder];
          }
  
          for (id obj in arrayWithPayments)
          {
              NSLog(@"%@",obj);
          }
  
  
      }
      return 0;
  }
  </code></pre>
  
  <p>Would appreciate any help.</p>
  
  <p>Thank you very much for your time.</p>