Created functions for Assignment2.