Question: proper java language please both figures ComplexNumber -real: double -Imaginary: double +ComplexNumber + ComplexNumber(re: double, im: double) +getReal(): double *getimaginary(): double +addTwoComplexNumbers(a: ComplexNumber, b: ComplexNumber):

ComplexNumber -real: double -Imaginary: double +ComplexNumber + ComplexNumber(re: double, im: double) +getReal(): double *getimaginary(): double +addTwoComplexNumbers(a: ComplexNumber, b: ComplexNumber): ComplexNumber . Specifications for the ComplexNumbet Class The constructor without argument will in all field values to me The constructor with parameter should accept the real and imaginary values as arguments, and assign the values to the fields real and imaginary, The mutato/getter method getRealo will return the real value of the complex number, The mutatod gerter method getimaginary() will return the imaginary value of the complex number The addTwoComplexNumber() method will capto ComplexNumber type reference variables as arguments, and after adding these two complex numbers, it will retum ComplexNumber type reference variable. (Hint: Review slide numbers 76 and 84. Unit 4 (regular version)) . Specifications for the Driver Class In the same Juva package, create a new driver dass with the name ComplexNumber Demo Your FirstName. If your first name the name of this dass should be ComplexNumberDem This class will contain the public static methode your driver method, and header and fool methods you have defined earlier. From Inside the driver method do the following Call your header method and print the required info. b. Dedare wo ComplexNumber type reference wariables Ask the user to enter the real and imaginary number for the fint complex number and get those inputs with the help of a Sanne ference variable d. Instant are the fint ComplexNumber type reference variable Repeat steps and d) for the second one f Declare a third ComplexNumber type reference warable and manciate with the no argument constructor. Using the variable call the addToComplexNumbent method and pass the two other ComplexNumber type de variable and in the returned value back to his third able ing printf) method print the results outlined in the sample output Call the foot method and end the program Your Full Name Lab #?, Question #? ** YourFirstName's complex-number adder: BE Let's add two complex numbers: Enter the real part of the first number: 3.52 Enter the imaginary part of the first number: 7.20 Enter the real part of the second number: 8.11 Enter the imaginary part of the second number: -9.31 You entered the following complex numbers: A = 3.52 + 7.20i B = 8.11 - 9.31i Here is the result: A + B - 11.63 - 2.111 ** Goodbye from yourFullName ***
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
