Define the convertCurrency Method
Insert the highlighted lines in Listing 3-2 into
Converter.m
.
Listing 3-2
Definition of the
convertCurrency
method in
Converter.m
#import "Converter.h"
@implementation Converter
@synthesize sourceCurrencyAmount, rate;
- (float)convertCurrency {
return self.sourceCurrencyAmount * self.rate;
}
@end
The
convertCurrency
method multiplies the values of the converter class's two member variables and
returns the result.
What's Next?
You just defined and implemented the basic functionality of your application by creating the model. In the
next chapter, you will create the view, which is the user interface for the application.
24
What's Next?
2007-10-31 | © 2007 Apple Inc. All Rights Reserved.
CHAPTER 3
Defining the Model