Import java.util.scanner;
Common class test {
//the solution of a quadratic equation with one variable
Private static X fx (int a, int b, int c) throws an exception {
X X = new X();
Double m = b * b-4 * a * c;;
If (m & gt=0){
x . x 1 =(- 1 * b+ math . sqrt(m))/(2 * a);
x . x2 =(- 1 * b-math . sqrt(m))/(2 * a);
Returns x;
}
Otherwise, a new exception ("no solution") is thrown;
}
Public static void main(String[] args) {
Try {
//input parameters a, b, c
Scanner CIN = new scanner (system. in);
system . out . print(" a = ");
int a = CIN . nextint();
system . out . print(" b = ");
int b = CIN . nextint();
system . out . print(" c = ");
int c = CIN . nextint();
//calculation
X x=fx(a,b,c);
//Display
system . out . println(" \ n 1x 1 = "+x . x 1+" \ nx2 = "+x . x2);
}catch (exception e){
system . out . println(e . getmessage());
}
}
}
//The packing class of solution set of quadratic equation in one variable
Class x {
Double x1;
Double x2;
}
Question 1:D
Question 2:C
Question 3: A.
Analysis of test questions: This essay