objective c - iOS timer/wage calculator -
I am creating a timer that takes hourly wage input and tracks how much money is made per second timer But the formatting works fine, but once the panes are hit by 99, it only adds to zero. Here's what I found
seconds = (int) (application time = (requested time - (min * 60)); Pennies = seconds * (rate * 100 per second); If (Penny> 99) {dollar ++; Panese = 0; } Self.moneyDisplay.text = [NSString stringWithFormat: @ "$% 02d.% 02d", dollar, penny];
Try it out:
seconds = (int ) (ElapsedTime = (elapsedTime - (min * 60)); Pennies = seconds * (rate * 100 per second); Float Dollar = Pennies / 100.0; Self.moneyDisplay.text = [NSString stringWithFormat: @ "$% .2f", dollar]; or:
seconds = (int (elapsedTime = (elapsedTime - (min * 60)); Pennies = seconds * (rate * 100 per second); Int cents = pennies% 100; Int dollar = Pennies / 100; Self.moneyDisplay.text = [NSString stringWithFormat: @ "$% 02d.% 02d", Dollar, St];
Comments
Post a Comment