# Question: use the following uml diagram as a guide to write...

###### Question details

Use the following UML diagram as a guide to write two classes to show arithmetic operations on complex number (objects). For this problem, you need to track (count) the total number of complex objects created. Remember each complex number has two numbers (real, imaginary). All the numbers are of double type. To save some time, use the toString( ) method provided (at the end) to print complex numbers ( x, yi). Your result should look like the following:

The number of Complex objects: 2

c1: 2.5 - 4.3i

c2: -12.34 + 4.33i

Real part of c1: 2.5

Imaginary part of c1: -4.3

Testing Mutators - Updated c2: -4.0 + 3.0i

c1 magnitude: 4.973932046178355

c2 magnitude: 5.0

c3: 6.5i

c4: 2.5 - 4.3i

The number of Complex objects: 4

Test: c1==c4 => true

**** Complex Arithmetic test ****

c1 = 2.5 - 4.3i c2 = -4.0 + 3.0i

c1 + c2 = -1.5 - 1.2999999999999998i

c1 - c2 = 6.5 - 7.3i

c1 * c2 = 2.8999999999999986 + 24.7i

The number of Complex objects created: 7

**// Textual Representation a + ci**

**public** String
toString**()** **{**

String s**;**

**if** **(**imaginary **==**
0**.**0**)**

s **=** **""** **+**
real**;**

**else** **if** **(**real
**==** 0**.**0**)**

s **=** imaginary **+**
**"i"****;**

**else** **if**
**(**imaginary **<**
0**)**

s **=** real **+** **" - "**
**+** **(-**imaginary**)**
**+** **"i"****;**

**else**

s **=** real **+** **" + "**
**+** imaginary **+**
**"i"****;**

**return** s**;**

**}**

**}**