Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write in C++ Learning Objectives Modular Programming, . Implementing Value-returning Functions, and Implementing Void Functions Definition 1. A Quadratic Equation is a second-order polynomial equa-

Write in C++

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Learning Objectives Modular Programming, . Implementing Value-returning Functions, and Implementing Void Functions Definition 1. A Quadratic Equation is a second-order polynomial equa- tion in a single variable r ax2 + bx + c 0 with a 0. a is referred to as the coefficient of the quadratic term, b, the coefficient of the linear term, and c, the constant term. Because a quadratic equation is a second-order polynomial equation, the fundamental theorem of algebra guarantees that it has two solutions. These solutions may both be real or complex Definition 2. The quantity D4ac is called the discriminant of a quadratic equation Definition 3. The axis of symmetry of a parabola is a vertical line that divides the parabola into two congruent halves. Given any horizontal line that intersects the parabola at two points, both points are equidistant from the axis of symmetry. The axis of symmetry of a parabola is the vertical line 2a Definition 4. A vertex of a parabola is the point at which it crosses the axis of symmetry. It is the lowest point (minimum) when the parabola is concave upward and the highest point (marimum) when it is concave downward. The vertex of a parabola is the point ( 2b,-F Definition 5. The x-intercepts are the points at which the parabola crosses the x-axis; that is, the points (r, y) such that y is 0. The x-coordinates of the x-intercepts are the roots of the equation. A quadratic equation may have zero, one or two intercepts. The y-intercept is the point at which the parabola crosses the y-axis; that is, the point (x, y) such that r is 0. The x-intercepts, when they exists, are (bt/i the discriminant of the quadratic equation. The y-intercept is (0, c), where c is the constant term 2a0,where D is Axis of Symmetry 6 X-intercepts 5 4 3 2 2 4 5 6 y-intercept 4 Vertex Figure 1: A Parabola for y -2r - 3 with Some of its Characteristics To facilitate easy program design, implementation and maintenance, espe- cially when writing large programs whose overall task can be disaggregated into several subtasks, a modular design should be used. This is the approach that you will use while writing this program 1. When the solution is real (not complex) and the irrational part of the solution is 0, the equation has only one root, rationalPart. The equation has only one x-intercept whose x-coordinate is rationalPart. 2. When the solutions are real and the irrational part of the solution is pos- itive, the equation has two real roots, rationalPart + irrationalPart and rationalPart - irrational Part 3. When the solutions are complex, the roots of the equation are rational Part + irrationalParti and rationalPart - irrationalParti where rational Part should be displayed only when it is non-zero. Also the equation has no x-intercepts To solve the quadratic equation, you will define two additional sub-functions between the using directive and the main functions k * * Computes the discriminant of a quadratic equation with * the specified parameters * Qparam qCoef the coefficient of the quadratic term * Qparam linCoef the coefficient of the linear term @paramcTerm the constant term * Oreturn the discriminant of a quadratic equation double discriminant(double qCoef, double linCoef, double cTerm) k * * Computes the rational and irrational parts of the solutions * of a quadratic equation with the specified parameters * Oparam qCoef the coefficient of the quadratic ternm Oparam linCoef the coefficient of the linear term OparamcTerm the constant term * Oparam rat the rational part of the solution * Oparam irrat the irrational part of the solution * Qparam cmplx indicates whether or not the roots are complex; * true when the roots are complex and false 1f they are real. void solve (double qCoef, double linCoef, double cTerm double& rat, double& irrat, bool& cmplx) Learning Objectives Modular Programming, . Implementing Value-returning Functions, and Implementing Void Functions Definition 1. A Quadratic Equation is a second-order polynomial equa- tion in a single variable r ax2 + bx + c 0 with a 0. a is referred to as the coefficient of the quadratic term, b, the coefficient of the linear term, and c, the constant term. Because a quadratic equation is a second-order polynomial equation, the fundamental theorem of algebra guarantees that it has two solutions. These solutions may both be real or complex Definition 2. The quantity D4ac is called the discriminant of a quadratic equation Definition 3. The axis of symmetry of a parabola is a vertical line that divides the parabola into two congruent halves. Given any horizontal line that intersects the parabola at two points, both points are equidistant from the axis of symmetry. The axis of symmetry of a parabola is the vertical line 2a Definition 4. A vertex of a parabola is the point at which it crosses the axis of symmetry. It is the lowest point (minimum) when the parabola is concave upward and the highest point (marimum) when it is concave downward. The vertex of a parabola is the point ( 2b,-F Definition 5. The x-intercepts are the points at which the parabola crosses the x-axis; that is, the points (r, y) such that y is 0. The x-coordinates of the x-intercepts are the roots of the equation. A quadratic equation may have zero, one or two intercepts. The y-intercept is the point at which the parabola crosses the y-axis; that is, the point (x, y) such that r is 0. The x-intercepts, when they exists, are (bt/i the discriminant of the quadratic equation. The y-intercept is (0, c), where c is the constant term 2a0,where D is Axis of Symmetry 6 X-intercepts 5 4 3 2 2 4 5 6 y-intercept 4 Vertex Figure 1: A Parabola for y -2r - 3 with Some of its Characteristics To facilitate easy program design, implementation and maintenance, espe- cially when writing large programs whose overall task can be disaggregated into several subtasks, a modular design should be used. This is the approach that you will use while writing this program 1. When the solution is real (not complex) and the irrational part of the solution is 0, the equation has only one root, rationalPart. The equation has only one x-intercept whose x-coordinate is rationalPart. 2. When the solutions are real and the irrational part of the solution is pos- itive, the equation has two real roots, rationalPart + irrationalPart and rationalPart - irrational Part 3. When the solutions are complex, the roots of the equation are rational Part + irrationalParti and rationalPart - irrationalParti where rational Part should be displayed only when it is non-zero. Also the equation has no x-intercepts To solve the quadratic equation, you will define two additional sub-functions between the using directive and the main functions k * * Computes the discriminant of a quadratic equation with * the specified parameters * Qparam qCoef the coefficient of the quadratic term * Qparam linCoef the coefficient of the linear term @paramcTerm the constant term * Oreturn the discriminant of a quadratic equation double discriminant(double qCoef, double linCoef, double cTerm) k * * Computes the rational and irrational parts of the solutions * of a quadratic equation with the specified parameters * Oparam qCoef the coefficient of the quadratic ternm Oparam linCoef the coefficient of the linear term OparamcTerm the constant term * Oparam rat the rational part of the solution * Oparam irrat the irrational part of the solution * Qparam cmplx indicates whether or not the roots are complex; * true when the roots are complex and false 1f they are real. void solve (double qCoef, double linCoef, double cTerm double& rat, double& irrat, bool& cmplx)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database In Depth Relational Theory For Practitioners

Authors: C.J. Date

1st Edition

0596100124, 978-0596100124

More Books

Students also viewed these Databases questions