Refactoring exercise using the Extract Variable refactoring for the Upcase Refactoring Trail.
Put the result of the expression, or parts of the expression, in a temporary variable with a name that explains the purpose. -- Martin Fowler
def total
amount + (amount * TAX) - (amount * (discount_percentage / 100.0)) + (amount * (tip_percentage / 100.0))
end
def total
tax = amount * TAX
discount = amount * (discount_percentage / 100.0)
tip = amount * (tip_percentage / 100.0)
amount + tax - discount + tip
end