Question: Part I: Applications to Mathematics using Classes and Objects Question #1-Complex Numbers (30pts) Write a class called Complex for performing arithmetic with complex numbers. Complex

 Part I: Applications to Mathematics using Classes and Objects Question #1-Complex

Part I: Applications to Mathematics using Classes and Objects Question #1-Complex Numbers (30pts) Write a class called Complex for performing arithmetic with complex numbers. Complex numbers have the following forms realParttirnaginaryPart*l where p=-1 Write a program to test your class. Use floating-point 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 Provide a no-argument constructor with defaults values in case no initializers are provided. Provide the following public methods that perform the following operations: a) Add two complex numbers (the real parts are added together, and the imaginary parts are added together) b) Subtract two complex numbers (the real part of the right operand is subtracted from the real part of the left operand, and the imaginary part of the right operand is subtracted fronm the imaginary part of the left operand) c) Print Complex numbers in the form (realPart, imaginaryPart)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!