Refactor of the method calculate
Change return type of the method convertToRPN