completed printCommand method
completed version all functions tested correct