CS60 Homework 11 ------------------------- Due Nov 5th @ 1:00pm C++! ------------------------- The task of this assignment is to make a complex number class. We've already covered the basic features of a complex number type, in this homeowrk you must use object oriented methodologies to implement a complex number object and a program that acts as a simple complex number calculator which allows the user to input two complex numbers, on operation to perform, and then prints the results. Your complex number class must implement the following member functions (my notation for a complex number is (x,y) == x + y*i) default constructor with no arguments constructor that takes two arguments (x, y) function to set x and y function to get x function to get y function to add two complexes function to multiply two complexes All of these member functions should be implemented such that the following code should function properly: int main() { complex a, b(1,0), c, d; a.set(1, 0); c.add(a, b); d.mul(a, b); cout << c.getx() << " + " << c.gety() << "i" << endl; cout << d.getx() << " + " << d.gety() << "i" << endl; } The above sample program (to be used for testing your complex number class) should print: 2 + 0i 1 + 0i The program you need to write should simply ask the user for the value of one complex, the value of another, an operation to perform, and then the result of the performed operation. If the user enters '-1' as the input to the real part of the first variable, the program should exit. Turnin -------------------- turnin tag is 'hw11' and MUST include the code 'complex.cpp', 'complex.h' and 'hw11.cpp' minimally. You must also create a 'Makefile' that manages your project, and a typescript showing compilation and execution of your program (compilation must be with -ansi -pedantic). Sample Output -------------------- [nurmi@localhost hw11]$ make clean rm -f *.o *.a *~* hw11 [nurmi@localhost hw11]$ ls Makefile complex.cpp complex.h main.cpp typescript [nurmi@localhost hw11]$ make g++ -ansi -pedantic -I./ -c -o main.o main.cpp g++ -ansi -pedantic -I./ -c -o complex.o complex.cpp making all g++ main.o complex.o -o hw11 [nurmi@localhost hw11]$ ./hw11 Enter real 1: 10 Enter imaginary 1: 1 Enter real 2: 10 Enter imaginary 2: 1 Enter operation (*, +): + 20 + 2i Enter real 1: 500 Enter imaginary 1: 40 Enter real 2: 0 Enter imaginary 2: 0 Enter operation (*, +): + 500 + 40i Enter real 1: 12 Enter imaginary 1: 11 Enter real 2: 3 Enter imaginary 2: 10 Enter operation (*, +): * -74 + 153i Enter real 1: 100 Enter imaginary 1: 43 Enter real 2: 1 Enter imaginary 2: 0 Enter operation (*, +): * 100 + 43i Enter real 1: 0 Enter imaginary 1: 1 Enter real 2: 0 Enter imaginary 2: 1 Enter operation (*, +): * -1 + 0i Enter real 1: -1 [nurmi@localhost hw11]$ make clean rm -f *.o *.a *~* hw11 [nurmi@localhost hw11]$