0

Can anyone help me out with this program

```
import java.util.Scanner;
public class Quadratic
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
System.out.print("Enter three coefficients for a quadratic equation: ");
double a = sc.nextDouble();
double b = sc.nextDouble();
double c = sc.nextDouble();
if (a == 0.0)
System.out.println("Error: a must be non-zero!");
else
{
double discriminant = Math.pow(b, 2.0) - (4 * a * c);
// Find out the root type by calling the method.
int rtype = determineRootType(discriminant);
// Do the rest.
double root1, root2;
switch (
{
{
case 1: // two real roots ;
root1 = (-b + Math.sqrt(discriminant)) / (2 * a);
root2 = (-b - Math.sqrt(discriminant)) / (2 * a);
System.out.println("Two roots: " + root1 + " and " + root2);
break;
case 2: // single root
root1 = -b / (2 * a);
System.out.println("Single root: " + root1);
break;
case 3: // two complex roots; it could be 'default' too.
System.out.println("Two complex roots.");
}
}
}
public static int determineRootType(double value)
{
if (value > 0)
return 1;
else if (value == 0)
return 2;
else
return 3;
}
}
```