我需要帮助编一本字典。这本词典的目的是计算税收抵免的规模。共有八个时间表,每个都有三个括号。您可以根据申请状态和符合条件的子女数量选择时间表。在第一个等级中,信贷按收入的百分比分阶段发放。在第二个括号中,信用额度最大化。在第三个等级中,信贷开始按收入的百分比逐步取消。问题是,我不知道该如何构造计算器来生成这些结果,或者这是否可行。我怀疑需要三个if语句,每个括号一个。到目前为止,我掌握的情况如下:
#import TaxReturn class
from TaxReturn import TaxReturn
#create brackets for phasein rates and phaseout rates for the earned income tax credit (EITC)
class EITC:
def __init__(self, taxReturn):
self.brackets = {
"single" and taxReturn.eic_qualify_children == 0 : ((0, .0765), (6480, .0765), (8110, .0765)),
"single" and taxReturn.eic_qualify_children == 1 : ((0, .34), (9720, .34), (17830, .1598)),
"single" and taxReturn.eic_qualify_children == 2 : ((0, .40), (13650, .40), (17830, .2106)),
"single" and taxReturn.eic_qualify_children > 2 : ((0, .45), (13650, .45), (17830, .2106)),
"married_jointly" and taxReturn.eic_qualify_children == 0 : ((0, .0765), (6480, .0765), (13540, .0765)),
"married_jointly" and taxReturn.eic_qualify_children == 1 : ((0, .34), (9720, .34), (23260, .1598)),
"married_jointly" and taxReturn.eic_qualify_children == 2 : ((0, .40), (13650, .40), (23260, .2106)),
"married_jointly" and taxReturn.eic_qualify_children > 2 : ((0, .45), (13650, .45), (23260, .2106))
}
#calculate EITC credit
def CalcEITC (self, taxReturn):
eitc_credit = 0
for bracket in reversed(self.brackets[taxReturn.taxComp.filing_status and taxReturn.eic_qualify_children]):
if taxReturn.taxPayments.earned_inc > bracket[0]:
eitc_credit += (taxReturn.taxPayments.earned_inc - bracket[0]) * bracket[1]
taxReturn.taxPayments.earned_inc -= taxReturn.taxPayments.earned_inc - bracket[0]
目前没有回答
相关问题 更多 >
编程相关推荐