Implemented Problem 1a and 1b.