Wrote some code to find roots of a polynomial via the quadratic formula, but it is reaching the end of the file while parsing. All my curly braces are closed, so I'm not sure where the error is. Can anybody see why?
public static void main(String[] args){ //execute the previously defined methods to calculate the quadratic equation.
while (cont){
Scanner Ascanner = new Scanner(System.in); //Created a new scanner variable for the A value.
double a = Ascanner.nextInt(); //Storing the next integer of that scanner variable for an Integer of the A value.
double b = Ascanner.nextInt(); //Storing the next integer of that scanner variable for an Integer for the B value.
double c = Ascanner.nextInt(); //Storing the next integer of that scanner variable for an Integer of the C value.
//Finding the radicand
double tem1 = handleradicand(a,b,c);
System.out.println("radicand" + tem1);
//Finding the radical
if (tem1 <= 0) {
double tem2 = sub_0rootradicand(tem1);
System.out.println("radical" + tem2);
double tem3 = divideBby2a (b,a);
double tem4 = divideRADby2a (tem2, a);
double firstX = findroot1 (tem3, tem4);
double secondX = findroot2 (tem3, tem4);
System.out.println("Your roots are X = i " + firstX + " " + "and X = i " + secondX);
} else {
double tem2 = rootradicand(tem1);
System.out.println("radical" + tem2);
double tem3 = divideBby2a (b,a);
double tem4 = divideRADby2a (tem2, a);
double firstX = findroot1 (tem3, tem4);
double secondX = findroot2 (tem3, tem4);
}
system.out.println("Again? (y/n)");
resp = Ascanner.next();
if(resp.equalsIgnoreCase("n") || resp.equalsIgnoreCase("y")){
if(resp.equalsIgnoreCase("n")){
cont = false;
} else {
cont = true;
}
}
}
EDIT: Was missing curly braces at the end, fixed.