Quadratic Root Solver For a general quadratic equation y = ax + bx + c, the roots can be classified into three categories depending upon the value of the discriminant which is given by b2 - 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: -b± Vb? – 4ac 2а Further, if the discriminant is a negative value, then there are two imaginary roots. In this case, the roots are given by B² – 4ac 2a b 2a Programming tasks: A text file, coeff.txt has the following information: coeff.txt 3 4 4 4 1 4 1 Each line represents the values of a, b and 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.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%
Quadratic Root Solver
For a general quadratic equation y = ax? + bx + c, the roots can be classified into
three categories depending upon the value of the discriminant which is given by
b2 - 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:
-b+ 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
b
ь? - 4ас
2a
2a
Programming tasks:
A text file, coeff.txt has the following information:
coeff.txt
3
4
4
4
1
4
Each line represents the values of a, b and 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.
Transcribed Image Text:Quadratic Root Solver For a general quadratic equation y = ax? + bx + c, the roots can be classified into three categories depending upon the value of the discriminant which is given by b2 - 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: -b+ 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 b ь? - 4ас 2a 2a Programming tasks: A text file, coeff.txt has the following information: coeff.txt 3 4 4 4 1 4 Each line represents the values of a, b and 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.
Expert Solution
steps

Step by step

Solved in 2 steps with 4 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY