int Bonus = .3 (need percentage this equals 30%)
label = (textfield * Bonus)
New to Objective-C, standing by if more clarifications is needed.
update: SOLVED! Solution:
HERE IS .h file:
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController {
IBOutlet UILabel *label;
IBOutlet UITextField *textfield;
}
- (IBAction)save:(id)sender;
@end
Here is .m file
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)save:(id) sender {
float x = ([textfield.text floatValue]);
float bonus = .3;
float result;
result = x * bonus / 10;
// Divide by 10 to keep it percentage based
label.text = [[NSString alloc] initWithFormat:@"%.2f", result];
Thanks for everyones help! Especially Xu Yin!!