Question
This is a java eclipse problem. -Make sure you submit 2 files - the .java file that defines the object - ComplexNumber.java the usage file
This is a java eclipse problem.
-Make sure you submit 2 files -
the .java file that defines the object - ComplexNumber.java
the usage file - ComplexNumberUsage.java(or something similar)
complex number has 2 parts: real number & imaginary number
addition of 2 complex numbers cn1, cn2
cn1's real part + cn2's real part
cn1's imaginary part + cn2's imaginary part
subtraction of 2 complex numbers cn1, cn2
cn1's real part - cn2's real part
cn1's imaginary part - cn2's imaginary part
multiplication of 2 complex numbers
( (cn1's real part cn2's real part) - (cn1's imaginary part cn2's imaginary part) ) +
( (cn1's real part cn2's imaginary part) + (cn1's imaginary part cn2's real part) )
2 complex numbers : (a+ib) & (c+id)
addition : ( (a+c) + i(b+d) )
subtraction : ( (a-c) + i(b-d) )
multiplication : ( (ac-bd) + i(ad+bc) )
1) ComplexNumber.java should have the following as a minimum :
-fields/properties for a complex number(i.e. 2 double numbers)
-constructor which takes in 2 double values as parameters & assigns them to the fields.
-add method
-subtract method
-multiply method
-toString method
2) ComplexNumberUsage.java should have ONLY the main method.
Inside the main, the following will be needed to accomplish our goal :
-declare 2 ComplexNumber objects
-get 4 double values from user (because we need 2 values to create a complex number - first 2 double numbers form the first complex number & the second 2 double numbers form the second complex number)
-create the 2 complex numbers by using the values got from user.
-Use the methods (add, subtract, multiply) & display the result
For the Answer, could someone take a picture of their Eclipse and post that, Its much easier for me. Or post their .java file
Step 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