Answered step by step
Verified Expert Solution
Question
1 Approved Answer
in c++ and try to make it as simple as possible since we are in the middle of the course we didnt take everything yet
in c++ and try to make it as simple as possible since we are in the middle of the course we didnt take everything yet ,, Thanks in advance.
9 Define a class called Complex which consists two private data x and y with double type and three public member functions: a constructor Complex (), void setNumber(double double), void printNumber(). In the function setNumber, you need to verify if the values of x and y are located between - 100 and 100. If not set the value to be 0.0. In the print Number, print the following message: X.XX + X.XX i where x is a digit and i represents pure imaginary part 1-1. If the imaginary part is negative, don't output +. If either real or imaginary part is 0, output 0.00 In your main program, use keyboard to input an array size. Next, use new to create an array of type Complex with inputted size. Then, prompt user to input the values of x and y, and call setNumber() for each array element. Finally, call printNumber() to display the complex numbers for all objects. Sample output: Enter an integer for array size: 3 Enter two real numbers for a complex: 12.23 2.3 (repeat 3 times) There are 3 complex numbers: 12.23 +2.30 i -23.45-23.89 i 0.00 +2.00Step 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