Then, write a C++ program that will use the Complex class to repeatedly do one of the following tasks: a) Perform a complex number arithmetic operation. For this option, the program will ask the user to enter a complex number, an arithmetic operation (+, –, *, /), and a second complex number, and will then calculate and display the result of performing the arithmetic operation on the two input complex numbers. b) Determine if a complex mumber is a solution of a quadratic equation. For this option, the program will prompt for and read in the real number coefficients, a, b, and c, of a quadratic equation, ax²+bx+c=0. Next, it will prompt for and read in a complex number, z. Then, it will determine if z is a solution of the quadratic equation. Note: When checking for equality of two complex numbers, do not use the "is equal to" operator on the float values - instead, determine if the absolute value of the float values are smaller than a threshold value (something small, like 0.000001). To extract input of a complex number a + bi from keyboard, do the following: double a, b; char i; cin >>a >> b>> i; Complex Number Review: A complex number is a number of the form a + bi where a and b are real numbers and i is the imaginary unit, i=v-1_ Addition/Subtraction: (a+bi )±(c+di)=(a±c)+(b±d)i (a+bi )*(c+di)=(ac– bd) +( ad +bc ) i Multiplication: a+bi ac+bd bc-ad i Division: c+di c²+d? c?+d?

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
1. Create a class, called complex, for modeling complex numbers, a + bi, and some complex number
arithmetic/comparison operations.
Here is what should be included within this class:
Include a no-argument constructor (to initialize a complex number to 0+0i).
Include public member functions to perform these complex number tasks:
Addition of complex numbers
Subtraction of complex numbers
o Multiplication of complex numbers
Division of complex numbers
User input of a complex number
o Display of a complex number
Conversion of a real number, r, to a complex number, r + 0i
Check for equality of two complex numbers
Transcribed Image Text:1. Create a class, called complex, for modeling complex numbers, a + bi, and some complex number arithmetic/comparison operations. Here is what should be included within this class: Include a no-argument constructor (to initialize a complex number to 0+0i). Include public member functions to perform these complex number tasks: Addition of complex numbers Subtraction of complex numbers o Multiplication of complex numbers Division of complex numbers User input of a complex number o Display of a complex number Conversion of a real number, r, to a complex number, r + 0i Check for equality of two complex numbers
Then, write a C++ program that will use the Complex class to repeatedly do one of the following
tasks:
a) Perform a complex number arithmetic operation. For this option, the program will ask the user
to enter a complex number, an arithmetic operation (+, –, *, /), and a second complex number,
and will then calculate and display the result of performing the arithmetic operation on the two
input complex numbers.
b) Determine if a complex number is a solution of a quadratic equation. For this option, the
program will prompt for and read in the real number coefficients, a, b, and c, of a quadratic
equation, ax?+bx+c=0. Next, it will prompt for and read in a complex number, z. Then, it will
determine if z is a solution of the quadratic equation.
Note: When checking for equality of two complex numbers, do not use the "is equal to" operator
on the float values - instead, determine if the absolute value of the float values are smaller than a
threshold value (something small, like 0.000001).
To extract input of a complex number a + bi from keyboard, do the following:
double a, b;
char i;
cin >>a >> b>> i;
Complex Number Review:
A complex number is a number of the form a+ bị where a and b are real numbers and i is the
imaginary unit, i=v-1
Addition/Subtraction: (a+bi )±(c+di)=(a±c)+(b±d)i
Multiplication: (a+bi )*(c+di)=(ac-bd)+(ad+bc)i
ас + bd bc — ad
c²+d? c?+d?
ас
a+bi
+
Division: C+di
Transcribed Image Text:Then, write a C++ program that will use the Complex class to repeatedly do one of the following tasks: a) Perform a complex number arithmetic operation. For this option, the program will ask the user to enter a complex number, an arithmetic operation (+, –, *, /), and a second complex number, and will then calculate and display the result of performing the arithmetic operation on the two input complex numbers. b) Determine if a complex number is a solution of a quadratic equation. For this option, the program will prompt for and read in the real number coefficients, a, b, and c, of a quadratic equation, ax?+bx+c=0. Next, it will prompt for and read in a complex number, z. Then, it will determine if z is a solution of the quadratic equation. Note: When checking for equality of two complex numbers, do not use the "is equal to" operator on the float values - instead, determine if the absolute value of the float values are smaller than a threshold value (something small, like 0.000001). To extract input of a complex number a + bi from keyboard, do the following: double a, b; char i; cin >>a >> b>> i; Complex Number Review: A complex number is a number of the form a+ bị where a and b are real numbers and i is the imaginary unit, i=v-1 Addition/Subtraction: (a+bi )±(c+di)=(a±c)+(b±d)i Multiplication: (a+bi )*(c+di)=(ac-bd)+(ad+bc)i ас + bd bc — ad c²+d? c?+d? ас a+bi + Division: C+di
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 5 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY