AllExperts > Experts 
Search      

Java

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More Java Answers
Question Library

Ask a question about Java
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Artemus Harper
Expertise
I have a BS in computer science and am working towards a Masters degree.

Experience
I have experience in Core Java, good background in Java swing/gui, some experience with JNI, Java reflection, and Java java.nio.* knowledge of Java bytecode and annotations. Basics in c++ and c#
 
   

You are here:  Experts > Computing/Technology > Focus on Java > Java > Please!Please! help me to write this program

Topic: Java



Expert: Artemus Harper
Date: 7/18/2008
Subject: Please!Please! help me to write this program

Question
write a program to input the values of three coefficients of a quadratic equation (AX(square)+BX+C=0)find the roots of the equation and display them whether they are real imaginary or equal. I have tried a lot to solve it so please i am begging for help. and note in the above equation i was unable to write square so i have written x(square).

Answer
Just use the Quadratic equation (http://en.wikipedia.org/wiki/Quadratic_equation)

Have a test in your program, if the part under the square root is non-negative, then evaluate normally, otherwise multiply that part by -1, take the square root, divide by the bottom part and that is your imaginary part (positive and negative), while the real part is just -b/2a (and is the same for both roots).

Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.