+ 2

Error

Exception in thread "main" java.lang.UnsupportedOperationException: Not supported yet. at scanner.<init😠scanner.java:17) at NewClass.main(NewClass.java:18) C:\Users\saeide\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1 BUILD FAILED (total time: 0 seconds)

2nd Mar 2018, 5:39 AM
tasnim
6 Antworten
+ 11
IT LOOKS LIKE U USED "math" in place of "Math" //code works fine ,see here //might not work for quadratic eqn's having imaginary roots https://code.sololearn.com/czzFHW22wn94/?ref=app
2nd Mar 2018, 8:29 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 10
1)Scanner 2)nextDouble() 3)Math.pow( , ) 4)"import java.util.Scanner;" is missing 5)create only 1 object of Scanner class & then use it multiple times //5 possible corrections 👍 //hope it helps
2nd Mar 2018, 7:01 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 9
might u didn't follow the my above comment carefully //no worries , here is the corrected code ☺👍 //look over the corrections import java.util.Scanner; public class solvequadraticequations { public static void main(String[] args) { double a; double b; double c; double r1; double r2; Scanner ina = new Scanner(System.in); a = ina.nextDouble(); b = ina.nextDouble(); c = ina.nextDouble(); r1=(((-b)+(Math.pow((b*b-4*a*c),0.5)))/(2*a)); r2=(((-b)-(Math.pow((b*b-4*a*c),0.5)))/(2*a)); System.out.println(r1); System.out.println(r2); } }
2nd Mar 2018, 7:10 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 4
not solve yet
2nd Mar 2018, 7:03 AM
tasnim
+ 2
this is my code public class solvequadraticequations { public static void main(String[] args) { double a; double b; double c; double r1; double r2; scanner ina = new scanner(System.in); scanner inb = new scanner(System.in); scanner inc = new scanner(System.in); a = ina.nextdouble(); b = inb.nextdouble(); c = inc.nextdouble(); r1=(((-b)+(math.pow((b*b-4*a*c),0.5)))/(2*a)); r2=(((-b)-(math.pow((b*b-4*a*c),0.5)))/(2*a)); System.out.println(r1); System.out.println(r2); } }
2nd Mar 2018, 5:41 AM
tasnim
+ 2
Exception in thread "main" java.lang.UnsupportedOperationException: Not supported yet. at math.pow(math.java:14) at solvequadraticequations.main(solvequadraticequations.java:30) C:\Users\saeide\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1 BUILD FAILED (total time: 7 seconds) this error for your code...
2nd Mar 2018, 8:18 AM
tasnim