convert switch ~ case to amountFor by extract method pattern