Find Laplace Transform of the function $$f_T(t)=\begin{cases}2, & 0\leq t < T \\ 1, & t\geq T \end{cases}$$
 A: Here is it
$$\int_{0}^{\infty}f_T(t)e^{-st}dt=\int_{0}^{T}2\,e^{-st}dt + \int_{T}^{\infty}1\,e^{-st}dt $$
$$ = 2\int_{0}^{T}e^{-st}dt + \int_{T}^{\infty} e^{-st}dt $$
$$ = 2 \frac{e^{-st}}{-s}\Big|_{0}^{T} + \frac{e^{-st}}{-s}\Big|_{T}^{\infty}=\dots\,. $$
I think you can finish it now. Note that you need to assume $Re(s)>0$.
A: Another way to look at this is to see that there is a complete LT, plus some extra.  To wit:
$$\hat{f}(s) = \int_0^{\infty} dt \, e^{-s t} + \int_0^{T} dt \, e^{-s t} $$
This is easy to evaluate:
$$\hat{f}(s) = \frac{1}{s} + \frac{1}{s} \left ( 1-e^{-s T}\right) = \frac{2-e^{-s T}}{s}$$
A: For piece-wise defined functions, such as your example, you either apply the definition, as Mhenni solution shows (and that is the easiest for this example) or if you want a more general approach you need to read about the step function also known as Heaviside function. Here is a brief description of what is involved. 
For $c\ge0$ define the step function as
$u_c(t)=\cases{ 0 & if $t<c$ \cr
 1 & if $c<t$ \cr }$.
Use Mhenni approach (i.e. definition of Laplace transform) to find $\displaystyle \cal L[u_c(t)]={e^{-cs}\over s}$. 
Next you need to derive the ``shift and switch'' formula $\displaystyle {\cal L}[u_c(t) f(t-c)]={e^{-cs} F(s)}$. 
Now  if you have a piece-wise defined function as in
$f(t)=\cases{ f_1(t) & if $t<c_1$ \cr
 f_2(t) & if $c_1<t<c_2$ \cr 
f_3(t) & if $c_2<t$}$, for some given $0\le c_1 < c_2$,
write it as $f(t)=f_1(t)+u_{c_1}(t)(f_2(t)-f_1(t))+u_{c_2}(t)(f_3(t)-f_2(t))$, then apply whatever algebra is necessary to match the shift and switch times to use that formula. This generally means that if you have  $g(t)=g_1(t)+u_{c_1}(t)g_2(t)+u_{c_2}(t)g_3(t)$ you rewrite it as $g(t)=g_1(t)+u_{c_1}(t)g_2(t-c_1+c_1)+u_{c_2}(t)g_3(t-c_2+c_2)$ and expand each of these functions using whatever identities apply to them.
