Quadratic Root Solver For a general quadratic equation y = ar' + bx + c, the roots can be dlassified into three categories depending upon the value of the discriminant which is given by b - 4ac First,...


Answer it with C++ programming


Quadratic Root Solver<br>For a general quadratic equation y = ar' + bx + c, the roots can be dlassified into<br>three categories depending upon the value of the discriminant which is given by<br>b - 4ac<br>First, if the discriminant is equal to 0, there is only one real root. Then, if the discriminant<br>is a positive value, there are two roots which are real and unequal. The roots can be<br>computed as follows:<br>-bt Vb - 4ac<br>2a<br>Further, if the discriminant is a negative value, then there are two imaginary roots. In<br>this case, the roots are given by<br>- 4ac,<br>2a<br>Programming tasks:<br>A text file, coeff.txt has the folowing information:<br>coeff.txt<br>3<br>5<br>1<br>5<br>1<br>5<br>Each line represents the values of a, band c, for a quadratic equation. Write a program<br>that read these coefficient values, calculate the roots of each quadratic equation, and display<br>the results. Your program should perform the following tasks:<br>• Check if the file is successfully opened before reading<br>• Use loop to read the file from main function<br>• Use programmer-defined function named calcRoots () to calculate the roots<br>• Display the type of roots and the root(s) for each equation to console screen.<br>Format the output to be displayed in floating point numbers, which set to two (2)<br>decimal places of precision.<br>• Display a message

Extracted text: Quadratic Root Solver For a general quadratic equation y = ar' + bx + c, the roots can be dlassified into three categories depending upon the value of the discriminant which is given by b - 4ac First, if the discriminant is equal to 0, there is only one real root. Then, if the discriminant is a positive value, there are two roots which are real and unequal. The roots can be computed as follows: -bt Vb - 4ac 2a Further, if the discriminant is a negative value, then there are two imaginary roots. In this case, the roots are given by - 4ac, 2a Programming tasks: A text file, coeff.txt has the folowing information: coeff.txt 3 5 1 5 1 5 Each line represents the values of a, band c, for a quadratic equation. Write a program that read these coefficient values, calculate the roots of each quadratic equation, and display the results. Your program should perform the following tasks: • Check if the file is successfully opened before reading • Use loop to read the file from main function • Use programmer-defined function named calcRoots () to calculate the roots • Display the type of roots and the root(s) for each equation to console screen. Format the output to be displayed in floating point numbers, which set to two (2) decimal places of precision. • Display a message "There is no solution – not a quadratic" if a equal to 0.

Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here