Working with Java to create a program to calculate Quadratic Formula -
so working on program. executes fine math not right. if input 2,s should result (0,0) getting (1,-1). if fresh set of eyes give me idea calculations wrong , did appreciate it!
system.out.println("please enter value d: "); int d = io.readint(); system.out.println("please enter value f: "); int f = io.readint(); system.out.println("please enter value g: "); int g = io.readint(); system.out.println("please enter value m: "); int m = io.readint(); system.out.println("please enter value b: "); int b = io.readint(); double y = (f - m); double u = (4*d*(g-b)); double = (2*d); double o = ((f+m)*(f+m)); /* * x=(-(f-m)(+ or -)(sqrt((f-m)^2) - (4d(g-b)) * 2d * * x=-b(+ or -)(sqrt((b^(2))-4ac)) * 2a */ double x = ((0-(y))+(math.sqrt(o)-((u)))/(i)); double x1 = ((0-(y))-(math.sqrt(o)-((u)))/(i)); io.outputstringanswer(x + " , " + x1);
check o value, not match comment...
Comments
Post a Comment