Levels Tought:
Elementary,Middle School,High School,College,University,PHD
Teaching Since: | Jul 2017 |
Last Sign in: | 271 Weeks Ago, 5 Days Ago |
Questions Answered: | 1850 |
Tutorials Posted: | 1850 |
Graduate in Biology and Nutrition, MBA Finance
Florida State University
Aug-2000 - Jul-2007
Ass. Relationship Manager
Penn-Florida
Mar-2009 - Feb-2016
Write a test program that prompts the user to enter two complex numbers and displays the result of their addition, subtraction, multiplication, division, and absolute value.
Â
Design a class named Complex for representing complex numbers and the methods add , subtract , multiply , divide , and abs for performing complex-number operations, and override toString method for returning a string representation for a complex number. The toString method returns (a + bi) as a string. If b is 0 , it simply returns a . Your Complex class should also implement the Cloneable interface.
Provide three constructors Complex(a, b) , Complex(a) , and Complex() . Complex() creates a Complex object for number 0 and Complex(a) creates a Complex object with 0 for b . Also provide the getRealPart() and getImaginaryPart() methods for returning the real and imaginary part of the complex number, respectively.Â
The desired output is attached:
Attachments:
Hel-----------lo -----------Sir-----------/Ma-----------dam----------- T-----------han-----------k y-----------ou -----------for----------- us-----------ing----------- ou-----------r w-----------ebs-----------ite----------- an-----------d a-----------cqu-----------isi-----------tio-----------n o-----------f m-----------y p-----------ost-----------ed -----------sol-----------uti-----------on.-----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am-----------Â -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll