::
Cosa c’è che non va?
Scanner scan = new Scanner(System.in);
System.out.println(“Please enter a: “);
double a = scan.nextInt();
System.out.println(“Please enter b: “);
double b = scan.nextInt();
System.out.println(“Please enter c: “);
double c = scan.nextInt();
double delta = (b*b)-4*a*c;
double x1 , x2;
if (delta == 0) {
x1=(-b -Math.sqrt(b*b-4*a*c)/(2*a));
x2=x1;
System.out.println(“Soluzioni coincidenti; “+ x1);
}
if (delta > 0){
x1=(-b -Math.sqrt(-b -Math.sqrt(b*b-4*a*c)/(2*a)));
x2=(-b +Math.sqrt(-b +Math.sqrt(b*b-4*a*c)/(2*a)));
System.out.println(“Soluzioni reali: “+x1 + ” “+ x2);
}
if (delta<0){
System.out.println(“Soluzioni complesse”);
}
}
}