Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- NSNumber *quantity = [NSNumber numberWithDouble:1];
- NSNumber *price_vat = [NSNumber numberWithDouble:0.76];
- double totalPrice = 293;
- totalPrice = totalPrice + [quantity doubleValue] * [price_vat doubleValue];
- NSString *s = [NSString stringWithFormat:@"%0.2f", totalPrice];
- NSLog(@"total: %@", s);
- // in case we're testing without the IBOutlet connected,
- // don't try to set its .text
- if (nil != self.priceLabel) {
- self.priceLabel.text = s;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement