coding up problem 4