implement problem 1-6 and 8-14