Created the functions necessary for the second programming assignment.