Write a java program called Q1.java that will do the following: Prompt for and read in three double numbers 'a', 'b', and 'c' which will be the coefficients of the quadratic equation ax^2 + bx + c = 0. Use the Equation class defined in type.lib to solve the equation and print out one of The equation <equation string> has no real root The equation <equation string> is an identity The equation <equation string> has one real root at <root1> The equation <equation string> has two real roots at <root1> and <root2> where <equation string> is the string representation of the equation as returned by the toString() method of Equation and <root1> and <root2> are the 1st and 2nd roots of the equation.The output should conform to that in the sample runs of a correct program shown below. Note that, in these sample runs, the % sign is not part of the program output. User input is shown on the same line as the prompt.
% java Q1 Enter 3 doubles as equation coefficients ... 0 0 0 The equation 0.0x^2 + 0.0x + 0.0 = 0 is an identity % % % java Q1 Enter 3 doubles as equation coefficients ... 2.0 6.0 4.5 The equation 2.0x^2 + 6.0x + 4.5 = 0 has one real root at -1.500000 % % java Q1 Enter 3 doubles as equation coefficients ... 9.12 1.0 2.0 The equation 9.12x^2 + 1.0x + 2.0 = 0 has no real root % % java Q1 Enter 3 doubles as equation coefficients ... 5.0 -15.0 10 The equation 5.0x^2 - 15.0x + 10.0 = 0 has two real roots at 1.000000 and 2.000000 %
Here (again) are the common APIs that you may access:
Here is the command to submit your work
(further details regarding the submit command can also be
obtained by
typing man submit
Once again, you are encouraged to submit
regularly.
Newer submissions overwrite older ones.
submit 1020 midtermW5 Q1.java