parmis lili
عضو جدید
اعداد مختلط(complex) و اعمال جمع وتفریق روی آنها است، را انجام دهید.
(Complex Numbers) Create a classcalled Complex for performing arithmetic with complex numbers. Complexnumbers have the formrealPart + imaginaryPart*i
where i is
Write a program to test your class.Use floating-point variables to represent the private data ofthe class. Provide a constructor that enables an object of this class to beinitialized when it is declared. Provide a no-argument constructor with default values incase no initializers are provided. Provide public methods that perform the followingoperations:
- Add two Complex numbers: The real parts are added together and the imaginary parts are added together.
- Subtract two Complex numbers: The real part of the right operand is subtracted from the real part of the left operand, and the imaginary part of the right operand is subtracted from the imaginary part of the left operand.