Assignment 2: Exploring classes and dynamic memory management Solution