Question: //Driver program using this class must //#include library //and #include to display all //numeric values with 3 digits after the decimal point //definition of the
//Driver program using this class must //#include library //and #include to display all //numeric values with 3 digits after the decimal point //definition of the class complexNumber //and implementation of the class' member functions //complex number has real and imaginary parts //in maths is defined as z = x + jy where //x (or re ) is a real part, and y (or im) //is an imaginary part. //class definition class complexNumber { //public member functions public: //Mutator function that sets values of the private //member variables void setCNumber(double x, double y); //Accessor functions that access private member variables //Functions declared "const" cannot change private variables double getRe() const; double getIm() const; //Function that calculates modulus of a complex number double modulus() const; //Function that calculates argument of a complex number double argument() const; //Function that displays a complex number in Cartezian format // as "re + j im" void print() const; //Function that displays a complex number in Polar format // as |z|cos(theta) void printPolar() const; //Function that adds two complex numbers and return //result as a new complex number complexNumber plus(complexNumber z1); //Constructors for the complexNumber class complexNumber(); //default constructor, no parameters, //sets re and im to sero complexNumber(double, double); //constructor with parameters //Private member variables private: double re; //Real part of the complex number double im; //Imaginary part of the complex number }; //Implementation of the member functions void complexNumber::setCNumber(double x, double y) { re = x; im = y; } double complexNumber::getRe() const {return re; } double complexNumber::getIm() const {return im; } double complexNumber::modulus() const { //place your code here } double complexNumber::argument() const { //place your code here } void complexNumber::print()const { //place your code here } void complexNumber::printPolar() const { //place your code here } complexNumber complexNumber::plus(complexNumber z1) { //place your code here } complexNumber::complexNumber(){re = 0; im = 0;} complexNumber::complexNumber(double x, double y){re = x; im = y; }
Hi I want the header file and program file coding for these codes, thanks
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
