Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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.00

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Multidimensional Array Data Management In Databases

Authors: Florin Rusu

1st Edition

1638281483, 978-1638281481

More Books

Students also viewed these Databases questions