I've finally got some idea of a code to right for my percentage formula.
basically the user is going to type in the amount for the product and the deposit % in the respective textfields and have the the actual charged amount appear in the charged textfield by hitting a submit button.
so far i got this:
i know the double value part is wrong but I'm not sure how to write it without it.
but the result comes out 0.00000
and I'm only trying to show xxxxxx.xx. with the last two numbers after the decimal representing cents.
anyone have any advice?
basically the user is going to type in the amount for the product and the deposit % in the respective textfields and have the the actual charged amount appear in the charged textfield by hitting a submit button.
so far i got this:
Code:
-(IBAction)SubmitB;
{
int depositPercent = [deposit.text doubleValue];
float amountMoney = [amount.text doubleValue];
float depositMoney = (depositPercent / 100);
float actualPercent = (depositMoney * amountMoney);
NSString *amountString = [[NSString alloc] initWithFormat:@" %f", actualPercent];
charge.text = amountString;
}
i know the double value part is wrong but I'm not sure how to write it without it.
but the result comes out 0.00000
and I'm only trying to show xxxxxx.xx. with the last two numbers after the decimal representing cents.
anyone have any advice?