Let $p$ be a prime and $G$ be a group of order $p^4$ such that $|Z(G)|=p^2$. Calculate the number of conjugacy classes of $G$.
I couldn't think of much except for, if $G$ acts on itself by conjugation, then each conjugacy class can be think of as an orbit. By the class equation, we have $$(1) \space p^4=|G|=p^2+\sum |\mathcal O_{x_i}|$$ where the sum is over a representative from each orbit of cardinal greater than 1.
We also $|\mathcal O_{x_i}|=\dfrac{|G|}{|C_G(x_i)|}$, where $C_G(x_i)$ is the centralizer of the element $x_i$. By (1) and by the fact that $x_i \not \in Z(G)$, we have $|\mathcal O_{x_i}| \in \{p,p^2,p^3\}$.
Here I got stuck, any hints or suggestions would be greatly appreciated.
If $x\notin Z(G)$, then $C_G(x) \supsetneq Z(G)$ but $C_G(x) \subsetneq G$. Since $[G:Z(G)]=p^2$, we must have $[G:C_G(x)]=p$ for all conjugacy classes. So all conjugacy classes have $p$ elements, and since $p^4 = p^2 + kp,$ there must be $k = p^3-p$ nontrivial conjugacy classes, so $p^3+p^2-p$ overall (including $Z(G)$).