Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Write a C++ program that performs following descriptions (30 points) A. Create a class called Complex that includes two pieces of information as B.

image text in transcribed

1. Write a C++ program that performs following descriptions (30 points) A. Create a class called Complex that includes two pieces of information as B. Your class should have a constructor that initializes the two data C. Provide member functions; add() and printComplex(). The add) data members - a real (type int) and an imaginary (type int) members function accepts a Complex object as the argument and adds two data members(i.e., real and imaginary) of a Complex object and data members of calling Complex object. Namely, a real is added to a real and an imaginary is added to an imaginary D. The add function's return type is Complex object. The step C and D can be used as follows Complex c1(1,2); Complex c2(3, 4); Complex c3(0, 0); c3 = c1.add(e2): E. The printComplex function prints out real and imaginary values of the calling Complex in the complex form (e.g., 1+2i) c3.printComplex); F. Create "Complex.h" file that declares member functions and data members, and G. Create "Complex.cpp" file that contains function implementations

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions