Here is my try

#import "Fraction.h"
@implementation Fraction
@synthesize numerator, denominator;
- (void) print
{
NSLog(@"%i/%i", numerator, denominator);
}
- (double) convertToNum
{
if (denominator !=0)
return (double) numerator / denominator;
else
return NAN;
}
- (void) setTo:(int)n over:(int)d
{
numerator = n;
denominator = d;
}
- (Fraction *) add:(Fraction *) f
{
//To add two fractions:
// a/b + c/d = ((a*d) + (b*c)) / (b*d)
//result will store the result of the addition
Fraction *result = [[Fraction alloc] init];
result.numerator = (numerator * f.denominator) + (denominator * f.numerator);
result.denominator = denominator * f.denominator;
[result reduce];
return result;
}
- (void) reduce
{
int u = numerator;
int v = denominator;
int temp;
while (v!= 0) {
temp = u % v;
u = v;
v = temp;
}
numerator /= u;
denominator /= u;
}
- (Fraction *) minus:(Fraction *) f
{
//To minus one fraction from another
Fraction *result = [[Fraction alloc] init];
//Find the greatest common denominator
int p;
p = denominator * f.denominator;
result.numerator = ((p / denominator) * numerator) - ((p /f.denominator) * f.numerator);
result.denominator = p;
[result reduce];
return result;
}
- (Fraction *) multiply:(Fraction *) f;
{
//To multipy one fraction by another
Fraction *result = [[Fraction alloc] init];
//Find the greatest common denominator
int p;
p = denominator * f.denominator;
result.numerator = (numerator * f.numerator);
result.denominator = p;
[result reduce];
return result;
}
- (Fraction *) divide:(Fraction *) f;
{
//to divide one fraction by another
Fraction *result = [[Fraction alloc] init];
result.numerator = numerator * f.denominator;
result.denominator = denominator * f.numerator;
[result reduce];
return result;
}
And the results :
2012-03-01 16:57:20.540 Excercise 7_1[7164:707] 1/2
2012-03-01 16:57:20.543 Excercise 7_1[7164:707] +
2012-03-01 16:57:20.547 Excercise 7_1[7164:707] 1/6
2012-03-01 16:57:20.547 Excercise 7_1[7164:707] =
2012-03-01 16:57:20.548 Excercise 7_1[7164:707] 2/3
2012-03-01 16:57:20.548 Excercise 7_1[7164:707] -----------------------------
2012-03-01 16:57:20.549 Excercise 7_1[7164:707] 1/2
2012-03-01 16:57:20.549 Excercise 7_1[7164:707] -
2012-03-01 16:57:20.550 Excercise 7_1[7164:707] 1/6
2012-03-01 16:57:20.550 Excercise 7_1[7164:707] =
2012-03-01 16:57:20.551 Excercise 7_1[7164:707] 1/3
2012-03-01 16:57:20.551 Excercise 7_1[7164:707] -----------------------------
2012-03-01 16:57:20.551 Excercise 7_1[7164:707] 1/2
2012-03-01 16:57:20.552 Excercise 7_1[7164:707] *
2012-03-01 16:57:20.552 Excercise 7_1[7164:707] 1/6
2012-03-01 16:57:20.552 Excercise 7_1[7164:707] =
2012-03-01 16:57:20.553 Excercise 7_1[7164:707] 1/12
2012-03-01 16:57:20.553 Excercise 7_1[7164:707] -----------------------------
2012-03-01 16:57:20.553 Excercise 7_1[7164:707] 1/2
2012-03-01 16:57:20.554 Excercise 7_1[7164:707] /
2012-03-01 16:57:20.554 Excercise 7_1[7164:707] 1/6
2012-03-01 16:57:20.557 Excercise 7_1[7164:707] =
2012-03-01 16:57:20.558 Excercise 7_1[7164:707] 3/1
Program ended with exit code: 0