Finished the third part of programming assignment 1