Assignment code added.

Added completed function for assignment.