let we have the following non homogeneous laplace equation 2D $$u_{xx}+u_{yy}=q(x,y)$$ where $0<x<a$ and $0<y<b$
with the conditions
$u(x,0)=f(x)$ where $0<x<a$
and
$u(x,b)=g(x)$ where $0<x<a$
and
$u(0,y)=0$ where $0<y<b$
and
$u(a,y)=0$ where $0<y<b$
find the following of this problem by using variables separation
Hint:
Since you didn't know how to begin, I will help you get started. In particular, you have the boundary value problem
$$\begin{cases}u_{xx}(x,y)+u_{yy}(x,y)=q(x,y),&x\in[0,a],y\in[0,b], \\ u(x,0)=f(x),&x\in[0,a], \\ u(x,b)=g(x),&x\in[0,a], \\ u(0,y)=u(a,y)=0,&y\in[0,b]. \end{cases}$$
To solve this via separation of variables, we look for solutions of the form $u(x,y)=\boldsymbol{X}(x)\boldsymbol{Y}(y)$.
Firstly, for the homogeneous Laplace equation
$$v_{xx}(x,y)+v_{yy}(x,y)=X''(x)Y(y)+X(x)Y''(y)=0$$
we may deduce that
$$\frac{X''(x)}{X(x)}=-\frac{Y''(y)}{Y(y)}=\pm\lambda^2,\qquad\lambda>0.$$
Now, you can solve the eigenvalue problem
$$\begin{cases}X''(x)\pm\lambda^2 X(x)=0, \\ Y''(y)\mp\lambda^2 Y(y)=0,\end{cases}$$ in order to determine $v(x,y)=X(x)Y(y)$.
Then you have $q(x,y)=v_{xx}(x,y)+v_{yy}(x,y)$ and you can probably solve from there.