Homework 6 Solution

$35.00 $29.00

In this program, you will design a C++ class to represent complex numbers. A complex number contains two separate parts: real and imaginary part. For instance, “5+4i” is a complex number, where 5 is the real part and 4 is the imaginary part. Your class will have 2 double attributes for 2 parts of a…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Description

5/5 – (2 votes)

In this program, you will design a C++ class to represent complex numbers. A complex number contains two separate parts: real and imaginary part. For instance, “5+4i” is a complex number, where 5 is the real part and 4 is the imaginary part.

Your class will have 2 double attributes for 2 parts of a complex number: real and imaginary. You will also implement following member functions for the class:

Getter and Setter Functions for 2 attributes

  • constructor functions

C3 = C1 + C2

Overload operator + for this operation

C3 = C1 – C2

Overload operator – for this operation

C3 = C1 * C2

Overload operator * for this operation

C3 = C1 / C2

Overload operator / for this operation

C1 == C2

Overload operator == for this operation

print()

prints the complex number

Your class must be written as two separate files: complex.h and complex.cpp. main.cpp file is given to you test your class. main.cpp file includes all necessary test cases so you do not need to change that file. If your class implementation is correct, main.cpp should work just fine, and its output should look like below:

On the top of your source code, please add your name and number, Course ID, HW number and the date using a comment block. Please see the example below,

/*

Myname MySurname – MY_STUDENT_NUMBER

CSCI 3000, HW-X

(Due Date)

*/

Please do not copy your code from someone else’s program. The instructor may use a code comparison program that automatically checks the similarity between different programs. And do not hesitate to contact me if you are having trouble with the homework. I will be more than happy to help you to solve your problem.

Homework 6 Solution
$35.00 $29.00