Question: Cpp program to calculate the first of the two solutions and the y coordinate of the vertex point (h, k) of a quadratic equation: ax2

Cpp program to calculate the first of the two solutions and the y coordinate of the vertex point (h, k) of a quadratic equation: ax2 + bx + c = 0 where variables a, b, and c are three constants (or coefficients). The diagram below illustrates a quadratic equation with two real solutions x1 and x2 and the vertex point at (h, k). x2 x1 Vertex (h, k) x f(x) 0 2x 2 + 4x 4 1. Calculate the first of the two solutions (roots) to a quadratic equation using the following formula: x1 = b + b 2 4ac 2a Assume that the quadratic equation to be solved has real solutions. You are going to use the skeleton program provided as starting point. The skeleton program includes a completed main() function and a function named findSolution to be completed for this part, which takes three constants a, b, and c and returns the first solution (root). The main() function asks (prompts) the user to input three values for constants a, b, and c and then call function findSolution to output the solution. Define all the variables as double. You may use the C++ library function sqrt to calculate the square root of a value. Use the following quadratic equation to test your program: 2x 2 + 4x 4 = 0 The first solution of the quadratic equation is 3 1 = 0.732 and the y coordinate of the vertex is 6. 2. Calculate the y coordinate of the vertex point at (h, k) of the quadratic equation using the following formula: Assume that f(x) = ax2 + bx + c CSC1321 Final Exam Page 2 The coordinates of the vertex can be calculated as h = b 2a k = f(h) = ah2 + bh + c You are about to complete the function findVertex that output the value of k, that is, the y coordinate of the vertex point.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!