Project 11: Get Y for Quadratic
Another example: A quadratic equation is an equation that can be written in the form is y = ax² + bx + c with a, b, and c being constants, or numerical coefficients, and x an unknown variable.
A graph of a quadratic is shown below where a = 1, b = -3, and c = -4
Question: What is the y-coordinate when x = 2 for the quadratic shown below?
Answer: -6
We can see the point (2, -6) on the graph pretty easily. However, if we substituted x = 2 into the equation we would also obtain y = -6.
y = (2)² - 3(2) – 4
y = 4 – 6 – 4
y = -6
Project 11: Your program has initialized variables 'a', 'b', 'c', 'x'
a, b, and c are the coefficients of the quadratic.
x is the value that we want to calculate the corresponding y-value (2 in the example above).
Your task: Appropriately initialize a variable called 'y' that corresponds to the y-value for the quadratic at the given x.
**If your code works for 5 test cases, you can enter your e-mail address
Universal Computational Math Methods:
pow(5,2) returns 25.0
abs(-3.0) returns 3
sqrt(49.0) returns 7.0