Solved Problem 6 & 7