Starting from:
$30

$24

Homework 2 Quadratic Equation Solver Solution

Program (60 points)




The requirements for our solver were updated. We now have to solve the linear solution that can result when a=0, and we have to output imaginary roots as well!

You will need to refine the flowchart/design we did together to handle the new requirements and then implement the program.

Requirements




•The program should give all roots including imaginary ones. This website can help you visualize the problem and what the expected roots would look




like. http://www.mathwarehouse.com/quadratic/quadratic-formula-calculator.php •If the coefficients constitute a linear equation you should calculate the single root. •Input:




•Three coefficients (a, b, and c respectively) on a single line separated by spaces.




•Output:




•The equation being solved.




•Roots.




•Each root on a separate line.




•If there is more than one root, then the one obtained by subtraction is first.




•Roots should be reported as







•x = <number







•x = <number + <numberi







Note that there is a single space on either side of an '=', a '+' or a '-'.

•If no valid solutions can be calculated, then output:







Unable to determine root(s).







•Note that endl puts a line return at the end. You should not put one after your last line of output.




Sample Runs




This is not complete testing!




•34-4




3x^2 + 4x + -4 = 0




x = -2




x = 0.666667




•344




3x^2 + 4x + 4 = 0




x = -0.666667 - 0.942809i




x = -0.666667 + 0.942809i




•-7 9 -8




-7x^2 + 9x + -8 = 0




x = 0.642857 - -0.854161i




x = 0.642857 + -0.854161i




Questions (20 points)




a.What is your updated design/flowchart? You can take a picture or scan and put in a document.

More products