Could you move this ``if-else`` to a separate method, f.e. ``computeAmount``?