Class Hierarchy Solution (Assignment 2, n3)