• Home
  • Blog
  • i need code with out plagarism and turnity.

i need code with out plagarism and turnity.

0 comments

QUADRATIC EQUATIONS

Given a quadratic equation in standard form, quadratic%20 %20standard, solutions for x can be determined using the quadratic formula, quadratic%20formula. The values of x can be real or complex. The discriminant, quadratic%20 %20discriminant, is used to determine the nature of the root(s). If the discriminant is negative, there will be no real roots. If the discriminant is 0, there will be one real root. In the third case, a positive discriminant will yield two real roots. (Real roots are of particular interest in solving physical world problems.)

Write a function that will determine the number of real roots for a quadratic equation as well as calculate any real roots. The function prototype should be:

Code Illustration
int calcQuadraticRoots(double a, double b, double c, double& x1, double& x2);

where a, b, and c represent the coefficients from the standard form of the quadratic equation and x1 and x2 represent the possible real roots.

If the number of real roots is zero, the function should return 0 without assigning values to x1 and x2. If the number of real roots is one, the function should assign the value of the real root to x1 and return 1. If the number of real roots is two, the function should assign the larger value to x1 and the smalle value to x2 and return 2.

Include driver code in function main() to test this function thoroughly. Your driver code should display the values of the coeffients of the quadratic equation, the number of roots of the quadratic equation as well as the roots of the quadratic equation.

Your program should not prompt the user to enter any information.

Although not required by this assignment, any additional functions you create would help to demonstrate your grasp of the concepts of top-down design and modular coding.

When you have completed and tested the program, submit the source code.

Note: Documentation requirements for in-lab assignments has not changed. The only documentation required is the main program header at the top of the program.

About the Author

Follow me


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}