Maximizing a pool's length A math project I am doing asks the following: 
Blammo is to be fired at ground level with a muzzle velocity of $35$ m/s over a flaming wall that is $15$ m high and a ground level shark pool. The pool will be made as long as possible. Determine the length of the pool, how far to place the cannon from the wall, and what elevation angle to use to ensure that Blammo clears the pool. 
$y(x)=tan(a)x-(x^2)((.004)/((cos(a))^2))$ represents the trajectory of Blammo, where a=the elevation angle. Initially I thought using a $45$ degree elevation angle would result in the longest pool length, but I forgot that the pool length was blammo's horizontal distance (which can be modeled as $125sin(2a))$ minus the distance from the flaming wall to the cannon. I graphed Blammos trajectory and $y=15$, and the first place they intersect is how far the cannon is from the flaming wall. Anyhow, after testing other elevation angles, I found the the one that would give the longest pool length (not the longest total distance of Blammo) was around $49$ degrees. How can I find the exact angle? Do I need to use optimization somehow? Is there an equation I can set up?
Edit: here’s a link to the problem, scroll down to the end for the shark trick with a picture : http://srvd.grupoa.com.br/uploads/imagensExtra/legado/A/ANTON_Howard/Calculo_10ed_VolI/Lib/Web_Projects/Web%20Projects%20-%20Expanding%20the%20Calculus%20Horizon/ch12.pdf
 A: The straightforward approach is that you have the equation of the parabola
$$y = x\tan{\alpha} - \frac{0.004x^2}{\cos^2{\alpha}}$$
for any given elevation angle $\alpha.$
There are two points of interest on this parabola: $P_W,$ the first point at which $y = 15$ (where Blammo would clear the wall) and $P_N,$ the last point at which $y = 0$ (the point where Blammo must land in the net).
Each of these points has an $x$-coordinate.
The values of these $x$-coordinates will depend on several assumptions and parameters of the equations, but the only thing among all those assumptions and parameters that can very is $\alpha$, so we can write the coordinates as functions of $\alpha$;
we can call them $x_W(\alpha)$ and $x_N(\alpha).$
Then the length of the shark pool is also a function of $\alpha,$ namely,
$$\text{length of pool} = f(\alpha) = x_W(\alpha) - x_N(\alpha).$$
Your job is to find $\alpha$ that maximizes $f(\alpha),$ and then arrange the cannon, wall, net and pool according to the dimensions given by $x_W(\alpha)$ and $x_N(\alpha).$

There are a alternative methods, though I suspect the ones I give below are not what would be expected, and they might make the person who grades your project work harder than they expected to figure out whether your answer is valid.
One alternative (which may or may not be easier) is to use a bit of knowledge of the physics of parabolic trajectories, namely that the total energy is constant and is the sum of potential energy (which can be written $mgy$) and kinetic energy (which can be written $\frac12mv^2$), from which we find that the velocity at any point is a function of the $y$-coordinate alone, independent of $\alpha.$
If $v = 35$ at $y=0$ then the velocity at $y = 15$ is the solution for $v_1$ in
$$ 9.8 \cdot 15 + \tfrac12 v_1^2 = \tfrac12 (35^2).$$
If you view the setup of the cannon and wall as a way to (in effect) launch Blammo from the top of the wall at some angle $\alpha_1,$ you can apply the formulas for maximum range of a projectile launched from a height above ground level;
see https://physics.stackexchange.com/questions/23186/maximum-range-of-a-projectile-launched-from-an-elevation.
One formula gives you the maximum length of the pool; another formula gives you $\alpha_1.$
You can then use $\alpha_1$ and $v_1$ to find the horizontal velocity
$v_1 \cos(\alpha_1),$ then use the fact that the horizontal velocity is constant,
that is, $v \cos(\alpha) = v_1 \cos(\alpha_1),$ to find $\alpha.$
Then you can find the total distance from the muzzle to the net, and from this and the known length of the pool you can get the distance from the muzzle to the wall.
You probably have not gotten the formula for maximum range of a projectile fired from a height above ground level at this point in your studies, however, so you would have to prove the formula in order to use it.
If you have proved the formula for maximum range of a projectile fired from a height above ground level, I think an even simpler alternative solution method is to work backwards from the net. The trajectory that maximizes the length of the pool in the given problem setup is the same as the trajectory that maximizes the length of the pool when you swap the positions of the cannon and net, that is, you launch Blammo from the right end of the pool at velocity $35$ m/s so he just clears the wall on the left end and lands in the net on the other side of the wall.
For that problem, assume the top of the wall is "ground level" and apply the formula for maximum range of a projectile fired from a height above ground level, using the height $-15,$ that is, the projectile is fired from below ground level.
(The same formula still works in this case, and your proof of the formula should have shown that fact.)
From this you get the length of the pool and the elevation angle $\alpha,$
and can solve for the other results.
