lesson4: added validation logic for calculator