Question: Solve this C++ problem(the problem is in the end) Lab Objectives This lab was designed to reinforce programming concepts from Chapter 9 of C++ How
Solve this C++ problem(the problem is in the end) Lab Objectives This lab was designed to reinforce programming concepts from Chapter 9 of C++ How To Program, Seventh Edi- tion. In this lab, you will practice: Creating new data types by writing class definitions. Defining member functions of programmer-defined classes. Instantiating objects from programmer-defined classes Calling member functions of programmer-defined classes. The follow-up questions and activities will also give you practice: Initializing programmer-defined class data members with class constructors Description of the Problem Create a class called Complex for performing arithmetic with complex numbers. Write a program to test your class. Complex numbers have the form real Part imaginaryPart where i is Use double variables to represent the private data of the class. Provide a constructor that enables an object of this class to be initialized when it is declared. The constructor should contain default values in case no initializers are provided. Provide public member functions that perform the following tasks a) Adding two complex numbers: The real parts are added together and the imaginary parts are added to- gether
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
