implement problem 1-5 and 8-10