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

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -