CS220

Assignment 7*


Please see programming quidelines.


An Augmented Complex Number Class

In this assignment you will modify the complex number class you created in the previous assignment.

a) Modify the class to enable output of complex numbers in the form (realPart, imaginaryPart i), through the overloaded _str_ method.
b) Overload the multiplication operator to enable multiplication of two complex numbers as in algebra, using the equation

(a, bi) * (c, di) = (a*c -b*d, (a*d + b*c)i) 

c) Overload the == operator to allow comparisons of complex numbers. [Note: (a, bi) is equal to (c, di) if a is equal to c and b is equal to d.]

The Steps

Step 1: Write a Python program as described above.

Step 2: Save your program as mp07.py.

Step 3: Test your program. If you discover mistakes in your program, correct them.


What You'll Turn In:

Using a zip-utility, zip up the following items into a single archive (call it mp07.zip) and submit it to the homework submission system.

  1. The file mp07.py.
  2. A read.me file which gives a brief description of what you learned from this assignment and any program limitations..


* problems From Deitel, Python, How To Program.