The problem:
Consider an infinite slab with uniform charge density $\rho$ between two planes $z=\frac{d}{2}$ and $z=-\frac{d}{2}$. Find the electric potential $V$ in the entire space and plot $V$ vs $z$.
I have been able to find the electric field using two Gaussian pillboxes:
Case 1: $z \geq \frac{d}{2}$ , $\vec{E}=\frac{\rho d}{2\varepsilon _{0}} \hat{k}$.
Case 2: $ \frac{d}{2} \geq z \geq -\frac{d}{2}$ , $\vec{E}=\frac{\rho z}{\varepsilon _{0}} \hat{k}$.
Case 3: $-\frac{d}{2} \geq z$ , $\vec{E}=\frac{-\rho d}{2\varepsilon _{0}} \hat{k}$.
But when I try to integrate those functions with respect to $z$ to find the electric potential, I end up getting two different values for $V(z=d/2)$ (case 1 and case 2) and two other different values for $V(z=-d/2)$ (case 2 and case 3).
I would appreciate a college-freshman-level explanation (preferable) and also a graduate-level one.