To save some typing I will illustrate part b, part a can then be done by simply setting the frictional forces to zero.Here is an illustration with force diagrams underneath:

m1----------------------------------------m2

<---.----> <---<---.--->

f1 T f2 T F

Here I have assigned f to be the frictional force, T is tension and F is force applied. Since our surface is horizontal we know that the normal force will just be equal to mg so I left weight and normal force out of these diagrams. Now we simply sum the forces on each block, apply Newtons second law and solve for what we want to know:

On m1 we have friction and tension so F=ma turns into:

T-f1 = m1a

I didnt bother with separate variables for acceleration, since we assume the string does not stretch or break the accelerations are equal. On m2 we have friction, tension, and force applied:

F-T-f2 = m2a

In both equations I have used the conventional coordinate axes where positive is to the right. I believe the simplest way to solve our system of two equations is to solve for T in both:

T = m1a + f1

T = F - f2 - m2a

Since the tension term in each equation refers to the same tension(on the same string!) we can set the right side of each equation equal to each other:

m1a + f1 = F - f2 - m2a

solving for a:

a = (F - f1 - f2)/(m1 + m2)

Now we simply use the definition of friction force f = uN and since we know N (the normal force) on a flat surface it is just calculator work now. Using the numbers given I get an acceleration of 1.24 m/s^{2}. To get the tension we just take the acceleration we just calculated and plug it into either of our two equations for tension, they both give the same answer: 17.768N

Now you can go back and do part a. Simply set f1 and f2 to zero and repeat.