Computer Science 1 Pgm05 Problem Solving and Program Design Using C++ Summer 2015 ax 2 bx c 0 . In addition to asking the user for values for a, b, 2 and c, you will ask the user for a tolerance value to be used to determine when the discriminant, b 4ac , is “close Write a program that will solve the quadratic equation enough” to zero to establish that the equation has one double real root, and you will ask the user for the desired number of decimals places for the answers. Given that the tolerance value has been given the name then the equation has one double real root x1 x toler , if b 2 4ac toler , b 2 . If b 4ac toler , then the equation has two real roots, 2a b b 2 4ac b b 2 4ac 2 and x2 . If b 4ac toler , then the equation has two complex roots, 2a 2a b c1 2a b 2 4ac 2a b i and c2 2a b 2 4ac i. 2a Sample Run Number 1: Program to solve quadratic equations: ax^2 + bx + c = 0 Enter a tolerance value: 0.000001 Enter the desired number of decimal places: 3 Enter values for a, b, and c: 1 2 3 The equation has two complex roots: c1 = -1.000 + 1.414i c2 = -1.000 - 1.414i Hit enter to exit the program: Sample Run Number 2: Program to solve quadratic equations: ax^2 + bx + c = 0 Enter a tolerance value: .00001 Enter the desired number of decimal places: 2 Enter values for a, b, and c: 1 -4.7 4.8 The equation has two real roots: x1 = 3.20 x2 = 1.50 Hit enter to exit the program: Sample Run Number 3: Program to solve quadratic equations: ax^2 + bx + c = 0 Enter a tolerance value: .0001 Enter the desired number of decimal places: 2 Enter values for a, b, and c: 1 -3 2.25 The equation has one real double root: 1.50 Hit enter to exit the program: Target Due Date: On or before Tuesday, July 14, 2015. NOTE: A sample executable, TaylorRPgm05.exe, has been place on the Z drive.
© Copyright 2025 Paperzz