Assignment 6 Solution

$30.00 $24.90


This is problem 10.8 (Complex Class) from your book. Consider the class Complex shown in Figs. 10.14-10.16 and included on T-Square. The class enables operations on so-called complex numbers. These are numbers of the form realPart + imaginaryPart * i, where i has the value squareroot of minus 1.

  1. Modify the class to enable input and output of complex numbers via overloaded >> and << operators, respectively (you should remove the existing print function from the class).

  1. Overload the multiplication operator to enable multiplication of two complex numbers as in algebra.

  1. Overload the == and != operators to allow comparisons of complex numbers.

Demonstrate addition, subtraction, multiplication, and the == and != operators. Look at the example code being run in the book for this problem and use that same input and output format. Allow numbers to be input typed in the following format: (7.4, -3.2). Print your output in that same format.

Turn in pdfs of your test cases results by uploading them to T-Square (please no JPEG or PNG or word, upload a pdf doc for your test cases). Also in addition, upload the source code files (uncompiled) on or before the due date so your program may be tested. How your code is commented, how well you tested the program (just one test case or enough test cases to prove it works), any extra functionality, how you output your test results and details of program output will all be taken into consideration when grading your program. Your format of your code should look like that of the book. Note the comments in the book above every function explaining what that function does. You should have comments at the top that includes your name, the date, explains what the program does and comments above the functions explaining what they do in addition to some comments as needed on lines that explain what that line does. Use multiple files with .h, .cpp for function implementations, .cpp for main test program.

Turn in code that lets the user enter two complex numbers, your code then adds them, subtracts, them, multiplies them, etc. This makes it easier to grade if grading does not require editing your source code to put in a different test case from what you used.