-1

Errors:

File: F:\lab_2.java  [line: 36]
Error: next cannot be resolved or is not a field
File: F:\lab_2.java  [line: 38]
Error: next cannot be resolved or is not a field
File: F:\lab_2.java  [line: 40]
Error: next cannot be resolved or is not a field
File: F:\lab_2.java  [line: 42]
Error: Duplicate local variable outa 

Code:

   else if (choice==1){
          int a;
          int b;
          int c;
          System.out.println("what is a ?");
          a=myscan.next ;   //line 36
          System.out.println("what is b ?");
          b=myscan.next ;   //line38
          System.out.println("what is c ?");
          c=myscan.next ;   //line40
       double outa =(b + Math.sqrt((b*b)-4*a*c))/(2*a);
       double outa =(b - Math.sqrt((b*b)-4*a*c))/(2*a);   //line42
       }
          //quadratic formula ^^^^
halfer
  • 19,824
  • 17
  • 99
  • 186
Jabari Little
  • 1
  • 1
  • 1
  • 1

1 Answers1

1

The error means that "next" is not a valid method or field on the variable myscan, which I assume is a Scanner. if "myscan" IS a Scanner, I think you're looking for input, so:

a=myscan.nextInt();

Also, you assign b+ and b- to outa, so you're overwriting the first answer with the second.

jedi.jesse
  • 773
  • 5
  • 11