Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Exercise 1 . [ 2 0 points A complex number is a number that can be expressed in the form a + ib , where
Exercise points
A complex number is a number that can be expressed in the form a ib where a and b are real numbers, and i is a solution of the equation x Because no real number satisfies this equation, i is called an imaginary number. For the complex number a ib a is called the real part, and b is called the imaginary part. When performing the arithmetic operations on complex numbers, remember to combine "similar" terms, ie the real and the imaginary parts. For two complex numbers a ib and c id the following operations are defined as follows:
Addition Rule: a ibc ida c ib d
Subtraction Rule: a ibc ida c ib d
Multiplication Rule: a ibc idac bd iad bc
Division Rule: a ibc idac bd ibc adc d
The complex conjugate of the complex number a ib is given as a ib
The polar form of a complex number z x iy can be written as z r cis where r Vx y is the magnitude of the complex number, and is the phase of z and
given as follows:
arctan
ifxy
if x y
undefined
if x y
a points Write the definition a separate h file for a class called complex that has double point data mebers for storing real and imaginary parts. The two data part should be private. The class should at least define the following public member functions: i to set the specified values in object, ii to display complex number object, iii Complex arithmetic operations defined on two complex numbers above and return a complex number iv to conjugate a complex object. Note that you may need to define additional methods.
Write the corresponding source file in a separate cpp file for your defined class. Consider all possible arithmetic operations given above, display styles as well as necessary outputs to produce See the sample runs below. You should have separate h and cpp for the defined complex class!
b points Write a C program a separate cpp file with a main function that uses the defined class in part a to produce the following outcomes. Note that you need ask the user to input two complex numbers to be stored as objects of your class. The data has to be private, hence only can be accessed within the class.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started