There are more than just one (1) possible solution to the given equation but to demonstrate how to derive at one solution I have prepared the following solution with the help of a soon-to-be PhD friend. I'm excited to see other people provide their answers to other possible equations that satisfy the original equation!
Equation (1):
This is the given equation from the problem:
$$ \left[x-x\left(\frac{z}{a}\right)\right]^2 + \left[y-y\left(\frac{z}a\right)\right]^2=r^2 $$
Equation (1) can be expanded and rearranged as follows:
$$ \left(x^2-\frac{2x^2z}{a}+\frac{x^2z^2}{a^2}\right)+\left(y^2-\frac{2y^2z}{a}+\frac{y^2z^2}{a^2}\right)=r^2 $$
Factor out $x^2$ and $y^2$:
$$ x^2\left(1-\frac{2z}{a}+\frac{z^2}{a^2}\right)+y^2\left(1-\frac{2z}{a}+\frac{z^2}{a^2}\right)=r^2 $$
Hence, we obtain the following:
Equation (2):
$$\left(x^2+y^2\right)\left(1-\frac{2z}{a}+\frac{z^2}{a^2}\right) = r^2$$
Note:
- For a circular base, in the $xy$ plane, $\left(x^2+y^2\right)$ should be related to $r^2$.
- Let the function $p=p\left(z\right)=1-\frac{2z}{a}+\frac{z^2}{a^2}$
- The form of $z$ will depend on the result of the relation between $\left(x^2+y^2\right)$ and $r^2$.
The inspiration for the form of the solutions for $x$ and $y$ can be derived from the transformation of cartesian coordinates to spherical coordinates (please see the figure below). Let's introduce two parameters, namely, $u$ and $v$.

Equation (3):
$$ x = r \cos{u}\sin{v} $$
$$ y = r \sin{u}\sin{v} $$
Using the forms given by Eq. (3), we can have a solution for a family of circular base (in the $xy$ plane) solutions, of the form:
$$x^2+y^2=\left(r\cos{u}\sin{v}\right)^2+\left(r\sin{u}\sin{v}\right)^2$$
$$=r^2\cos^{2}{u}\,\sin^{2}{v}+r^2\sin^{2}{u}\sin^{2}{v}$$
$$=r^2\sin^2{v}\left(\cos^2{u}+\sin^2{u}\right)$$
Since $(\cos^2{u}+\sin^2{u})$ is a Pythagorean Identity equal to $1$, we can further simplify and get
Equation (4):
$$x^{2} + y^{2} = r^{2}\sin^{2}{v}$$
Recall Eq. (2):
$$\left(x^2+y^2\right)p(z)=r^2$$
where $p(z) = \left(1-\frac{2z}{a}+\frac{z^2}{a^2}\right)$
If we divide Eq. (4) by $\sin^2{v}$ we get
Equation (5):
$$\left(x^2+y^2\right)\left(\frac{1}{\sin^2v}\right)=r^2$$
By inspection of Eqs. (2) and (5), we can easily see that:
$$\left(1-\frac{2z}{a}+\frac{z^2}{a^2}\right)=\frac{1}{\sin^2v}$$
Multiplying both sides by $a^2$:
$$z^2-2az+a^2-\frac{a^2}{\sin^2v}=0$$
Hence, we get:
Equation (6):
$$z^2-2az+a^2\left(1-\csc^2v\right)=0$$
which has the form of a Quadratic Equation:
$$Az^2+Bz+C=0$$
where:
$$A=1$$
$$B=-2a$$
$$C=a^2\left(1-\csc^2v\right)$$
Equation (7):
$$z=\frac{-B\pm\sqrt{B^2-4AC}}{2A}$$
$$ = \frac{-(-2a)\pm \sqrt{\left(-2a\right)^{2} - 4(1)[a^{2}(1 - \csc^{2}{v})]}}{2(1)}$$
$$=a\pm\frac{1}{2}\sqrt{4a^2-4a^2\left(1-\csc^2v\right)}$$
$$=a\pm\frac{1}{2}\sqrt{4a^2\left[1-\left(1-\csc^2v\right)\right]}$$
$$=a\pm\frac{1}{2}\sqrt{4a^2\csc^2v}$$
$$=a\pm\frac{1}{2}\left(2a\csc v\right)$$
$$z=a\pm a\csc v$$
$$z=a\pm \frac{a}{\sin{v}}$$
This is now Eq. (7).
One possible Parametric Equation Solution:
Collecting results, we have the following:
$$x=r\cos{u}\sin{v}$$
$$y=r\sin{u}\sin{v}$$
$$z=a\pm\frac{a}{\sin{v}}$$
Note:
- In the above results, for this particular form only, $z=z(v)$ only.
- In general, $z=z(u,v)$ as long as it satisfies Eq. (6).
- We can solve Eq. (6), as a quadratic equation because, we can also assume that $z=z(v)$ for illustrative purposes only.
- In other words, there can be many other forms of solutions as long as they satisfy Eq. (6), for the same equations for $x=x(u,v)$ and $y=y(u,v)$, given by Eq. (3).
