Classic Computations of Electric Flux
Electric flux through the endcap of a cylinder:
We consider a uniform electric field $\overrightarrow{E}$ and the right end of a cylinder with radius $R$ whose axis is parallel to the electric field. We let $d{\overrightarrow{A}}_1$ denote the outward normal of the right endcap and $d{\overrightarrow{A}}_2$ the outward normal for the lateral wall of the cylinder as shown below.
The electric field is constant over the circular endcap of radius $R$ and perpendicular to the surface $\left(\theta =0{}^\circ \right)$. The electric flux through the right endcap is therefore equal to the following
\iint_{endcap}{\overrightarrow{E}~\cdot d{\overrightarrow{A}}_1}=\iint_{endcap}{E{\mathrm{cos} \left(0\right)\ }dA_1}=E \iint_{endcap}{dA_1}=E\cdot \pi R^2
The electric field is parallel to the lateral wall of the cylinder $\left(\theta =90{}^\circ \right)$ and therefore the electric flux through the cylinder wall is zero. Indeed, we have
\iint_{wall}{\overrightarrow{E}\cdot d{\overrightarrow{A}}_2}=\iint_{wall}{E{\mathrm{cos} \left(90\right)\ }dA_2}=0
where ${\mathrm{cos} \left(90\right)\ }=0$ causes the entire flux through the lateral wall to cancel.
Electric flux through the lateral surface of a cylinder:
We consider a radial electric field $\overrightarrow{E}$ and a cylinder of length $L$ with radius $R$ whose axis is perpendicular to the electric field. We let $d{\overrightarrow{A}}_1$ denote the outward normal of the top endcap, $d{\overrightarrow{A}}_2$ the outward normal for the lateral wall of the cylinder, and $d{\overrightarrow{A}}_3$ the outward normal of the bottom encap as shown below.
The electric field is parallel to the top endcap of the cylinder $\left(\theta =90{}^\circ \right)$ and therefore the electric flux through the top endcap of the cylinder is zero. Indeed, we have
\iint_{endcap}{\overrightarrow{E}\cdot d{\overrightarrow{A}}_1}=\iint_{endcap}{E{\mathrm{cos} \left(90\right)\ }dA_1}=0
where ${\mathrm{cos} \left(90\right)\ }=0$ causes the entire flux through the top endcap to cancel.
The electric field is constant over the lateral wall of the cylinder and perpendicular to the surface $\left(\theta =0{}^\circ \right)$. The electric flux through the lateral wall of the cylinder is therefore equal to the following
\iint_{wall}{\overrightarrow{E}~\cdot d{\overrightarrow{A}}_2}=\iint_{wall}{E{\mathrm{cos} \left(0\right)\ }dA_2}=E \iint_{wall}{dA_2}=E\cdot 2\pi RL
where $A=2\pi RL$ is the surface area of the lateral wall of the cylinder.
By symmetry, the electric flux through the bottom endcap is also zero since the electric field is parallel to the bottom endcap.
Electric flux through a sphere:
We consider a radial electric field $\overrightarrow{E}$ and a sphere of radius $R$ with outward normal $d\overrightarrow{A}$.
The electric field is constant over the surface of the sphere and perpendicular to the surface $\left(\theta =0{}^\circ \right)$. The electric flux through the sphere is therefore equal to the following
\iint_{sphere}{\overrightarrow{E}~\cdot d\overrightarrow{A}}=\iint_{sphere}{E{\mathrm{cos} \left(0\right)\ }dA}=E\ \iint_{sphere}{dA}=E\cdot 4\pi R^2
where $A=4\pi R^2$ is the surface area the sphere.