Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java programming language a double 1. [10 marks] The UML class diagram represents a class to represent Complex number. A complex number has two parts,
Java programming language
a double 1. [10 marks] The UML class diagram represents a class to represent Complex number. A complex number has two parts, Complex one is real and another part is imaginary. The imaginary part is expressed with an i, for example, 5.5 +7.2i is a complex b: double number where a = 5.5 and b = 7.2. You have to define the implementation of the class according to the UML diagram. Complex(reat:double , imag: double) +Complex) The default constructor creates an Object of Complex class,+ComplextComplex): Complex 0.0 +0.0i. The third constructor initializes the object same as addtComplexx Complex given object, t. The add method takes a Complex number *multiply(t Complex): Complex object, t as parameter and retums a new Complex number +toString(): String after adding t with the object. The multiply method also returns a new Complex number as per mathematical formula given below. The toString method displays a complex number in the form of a +bi. 1. Addition: Z=X+Y - Z.a=X.a +Y.a and Z.b = X.b + Y.b 2. Multiplication: Z=X.Y - Z.a = X.a*Y.a - X.b*Y.b and Z.b = X.b*Y.a + X.a*Y.bStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started