Question: public class secondOrder { public static void main ( String [ ] args ) { / / declare variables for inputs double a , b
public class secondOrder
public static void mainString args
declare variables for inputs
double a b c;
get values from the user
Scanner sc new ScannerSystemin;
System.out.printlnEnter the coefficients a b and c: ;
a scnextDouble;
b scnextDouble;
c scnextDouble;
there two cases for a
ifa
ifb
ifc
System.out.printlnThere are infinite number og solutions";
else C
System.out.printlnThere no solutions";
else b
System.out.printlnThe equation is a first order equation and has one solution: cb;
else a
double D Math.powbac;
ifD
double x ba;
System.out.printlnThe equation has one double solution x;
else ifD
double xb Math.sqrtDa;
double xb Math.sqrtDa;
System.out.printlnThere are two distinct solutions:
X x
X x;
elseD
System.out.printlnThere are no real solutions";
Modify the program secondOrder equation to implement it as a class.
With a design of your choice no Scanner in class definition almost never!!
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
