Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started