Complex Number Class

The Complex Number Class project was developed as part of my coursework in ICS 212. The goal was to implement a C++ class to represent complex numbers in the form a + bi. The class includes constructors, accessor and mutator methods, and a print function capable of correctly formatting positive and negative imaginary parts. The program was fully self-contained and tested using multiple Complex objects in main(), without requiring user input.

For this project, I was responsible for designing the entire class structure, writing all member functions, and creating the test cases in main(). I ensured proper encapsulation by keeping the data members private and exposing only the necessary methods to interact with the class. I also implemented logic to handle edge cases such as negative imaginary numbers for correct output formatting.

Through this project, I learned the importance of object-oriented design principles, particularly encapsulation and data abstraction. I also gained experience in testing and debugging C++ programs, and in thinking critically about edge cases that could affect the output of a program. Additionally, I practiced writing clear and maintainable code with proper commenting, which will be valuable in collaborative software projects.

You can view the full source code for this project here:
Complex Number Project on GitHub