I strongly recommend that you draw this situation. The vertices of the right triangle are (2,0), (p,0) and (p, -p^2+8p-12).
We are to maximize the area of the triangle. To do this, we find the equation for the area (which is based upon the usual b*h/2), differentiate this formula, set the derivative = to 0 and solve for p. I obtained p = 14/3, or 4 2/3 units.
Keep in mind that the correct expression for the base here is p-2. Can you see why? The height is simply the function itself: p(x) = -x^2+8x-12.
Thus, the area of the triangle, in terms of p, is
(p-2)(-p^2+8p-12)
A(p) = ---------------------------
2
Let me know if you need further help with this problem. Good luck!