ProgrammingAssignment2

Update: added a test at the end of the code for viewers to follow.