Problem 2 of Course Project