aspose file tools
The moose likes Java in General and the fly likes equation problem Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "equation problem" Watch "equation problem" New topic
Author

equation problem

oghenekaro EFEKODO
Ranch Hand

Joined: Oct 10, 2005
Posts: 56
pls,i tried writing a program for quadratic equation but failed.i did this

public double equation(double a,double b,double c){
double d=Math.pow(b,2)-4*a*c;
if(d>0){
double x1=(-b+Math.sqrt(d))/2*a;
double x2=(-b-Math.sqrt(d))/2*a;
}
return;
}
couldn't attempt d==0 and d<0.
it was giving an error message.so what do i do and do solve others.thanks
Martin Simons
Ranch Hand

Joined: Mar 02, 2006
Posts: 196
What error message. Also you declare to return a double but actually
return nothing. Was this your error message, maybe?
Vladimir Nesov
Greenhorn

Joined: Jun 18, 2006
Posts: 20
Also note that 10/2*5 is 25, not 1. You wrote wrong in your formulae.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: equation problem
 
Similar Threads
Quadratic perplextion
Long Programming Problem
Handling NaN.....
methods and return type
Quadratic formula result problem