I know that for a continuous, non-piecewise function, you can usually find the mgf(x,t) of f(x) by integrating, from minus infinity to infinity, (e^tx)*f(x)dx.

But if given a piecewise function,

eg

g(x) = h(x) for 0<= x< infinity,

= j(x) for - infinity < x <= 0,

and h(0) = j(0)

do I firstly integrate from 0 to infinity, (e^tx)*h(x)dx,

then integrate from - infinity to 0, (e^tx)*j(x)dx,

and then multiply or add the two resulting integrals together in order to get the mgf of g(x) ?

I'm supposed to find the mean and variance after that, but I know how to do that once I know the mgf.