finished part a, b, and c for exercise 1 of hw5.