Challenge
Your challenge is to implement a class called TemperatureConverter that has a single method called degreesFarenheitToCelsius. It should take a float as a parameter that represents the degrees in farenheit, and return a float that represents the degrees in celsius.
Add this code to your App Delegate to test it:
#import "AppDelegate.h"
#import "TemperatureConverter.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
float degreesFarenheit = 80.0;
TemperatureConverter *converter = [[TemperatureConverter alloc] init];
float degreesCelsius = [converter degreesFarenheitToCelsius:degreesFarenheit];
NSLog(@"%0.2f degrees farenheit = %0.2f degrees celsius",
degreesFarenheit, degreesCelsius);
return YES;
}
@end
Download demo code
Download solution
Helpful links