Do you want the solution for the first one to get you going?
The part2 of problem 1 is somewhat a little more complex but once you get the idea, the rest shouldn't be that hard!
-----------------
Beno��t St-Jean
Yahoo! Messenger: bstjean
Twitter: @BenLeChialeux
Pinterest: benoitstjean
Instagram: Chef_Benito
IRC: lamneth
Blogue: endormitoire.wordpress.com
"A standpoint is an intellectual horizon of radius zero". (A. Einstein)