i am wondering about an implementation file:
i was given the implementation file and told to fill in the methods
i will include what i came up with, i know it is wrong, and i haven't tried to compile it. i am reading from a book by Stephen G. Kochan and
it talks about complex numbers, from the book "Complex numbers are numbers that contain two components:
a real and an imaginary part, if a is the real component, and b is the imaginary component, the notation
a + bi
is used to represent the number."
i think what the test program does is add not only two fractions but also two complex numbers like i said i never got the program to run here is what i have for the implementation file. i looked at the implementation for the fraction part of an implementation file for reference any help would be appreciated.
Code:
#import "Complex.h"
@implementation
-(void) print
{
printf (" % g" + "%gi",Real, imaginary);
}
-(void) setReal:(double) a
{
Real = a;
}
-(void) setimaginary:(double) b
{
imaginary = b;
}
-(void) setReal:(double) a andimaginary:(double)b
{
Real = a;
imaginary = b;
}
-(double) real
{
real = a;
}
-(double) imaginary
{
imaginary = b;
}
-(Complex *) add: (Complex *) f
{
(a + bi) add: (a + bi)
}
@ end
[code]
again any help would be appreciated.