Project 12: Equation of Parabola given Focus and Directrix

Project 12:  Variables 'verticalParabola', 'focusX', 'focusY', 'directrix' have been initialized.

verticalParabola represents if the parabola is vertical opens up or down or horizontal opens left or right (true if vertical; false if horizontal)

focusX represents the x-coordinate of the focus

focusY represents the y-coordinate of the focus

directrix represents the value of the directrix (i.e. y = directrix for vertical parabola, x = directrix for horizontal parabola)

Here are two examples below:

For the example above:

verticalParabola = false

focusX = -4

focusY = 0

directrix = 4 (which represents x = 4)

p is the distance between the vertex and the focus, which is the same as the distance between the vertex and the directrix.

p = 4

a = -1/16 here because the parabola is opening to the left and not the right.

For the example above:

verticalParabola = true

focusX = 0

focusY = -1.5

directrix = 1.5 (which represents y = 1.5)

p is the distance between the vertex and the focus, which is the same as the distance between the vertex and the directrix.

p = 1.5

a = -1/6 here because the parabola is opening down and not up.

Task: Appropriately the values of 'vX', 'vY', 'a'

vX and vY represent the coordinates of the vertex of the parabola.  

a represents the leading coefficient of the parabola as described above.

**If your code works for 5 test cases in a row, you can enter your e-mail address.