Implementing a class dealing with imaginary numbers
$5-10 USD
Completed
Posted about 21 years ago
$5-10 USD
Paid on delivery
Create a program implementing a class Complex having floating point data members for the real and the imaginary part of a complex number. The class must have the following member functions: • a default constructor that sets both the real and imaginary parts to zero • an initialization constructor • a function for setting the value of a Complex object • a function for extracting a Complex value from an input stream o numbers are entered in a+bi or a-bi format • a function to insert a Complex value in an input stream (in a+bi or a-bi format) • functions to perform addition, subtractions and multiplication of Complex objects In addition to the member functions above, overload the +, -, *, >> and << operators to work appropriately for Complex objects. Place the entire implementation of the class Complex in a file named Complex.cpp. This file will then be included by the program that tests it. You have to provide a function main() that invokes each element of the class several times in order to illustrate that they work properly. This means: • at least one Complex object is declared without being initialized • at least one Complex object is initialized at declaration • at least one Complex object has its value set • at least one Complex object is input using the extraction operator • at least one Complex object is output using the insertion operator • numbers with both positive and negative real and imaginary parts will be used Each function should have a short comment describing its action.
## Deliverables
1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
## Platform
C++