Implemented getCost()