import utils
+from money import money
class tax_brackets:
"""A class to represent tax brackets and some operations on them."""
def compute_taxes_for_income(self, income):
"""Compute the tax bill for income given our brackets."""
- taxes_due = 0
+ taxes_due = money(0)
while income > 1:
(threshold, rate) = self.get_bracket_for_income(income)
taxes_due += (income - threshold) * rate
def dump(self):
"""Print out the tax brackets we're using in here."""
for x in self.brackets:
- print "{:<20} -> {:<3}".format(utils.format_money(x[0]),
- utils.format_rate(x[1]))
+ print "{:<20} -> {:<3}".format(x[0], utils.format_rate(x[1]))