Example for calculating personal income tax

xiaoxiao2021-03-06  41

Recently I have written the algorithm for calculating personal income taxes, I feel better. Public float computeTax (float income) // income is salary {float f_income = income-800; // The kit is 800, but also parameterized processing float [] TAX_LINE = {0F, 500F, 2000F, 5000F, 20000F, 40000F, 60000F, 80000F, 100000F}; // Calculate the grade of personal income tax (assuming employees for Chinese nationality, because the nationality of different gage points, the tax rate is different.) Float [] TAX_RATE = {0F, 0.05F, 0.10F, 0.15 F, 0.20F, 0.25F, 0.30F, 0.35F, 0.40F}; // Each grade tax rate float [] TAX_SUB = {0.F, 25F, 125F, 375F, 1375F, 3375F, 6375F, 10375F, 15375F}; // use a simplified algorithm int i_tax_level = 0; // For the sake of easy way, save the salary while (f_income> TAX_LINE [i_TAX_LINE.LENGTH) {i_TAX_LINE.LENGTH) {i_Tax_LINE.LENGTH;}; if (i_tax_level> 0) {FLOAT F_TAX = TAX_SUB [i_TAX_LEVEL-1] (f_income-tax_line [i_tax_level-1]) * TAX_RATE [I_TAX_LEVEL]; // calculate the formula Return F_Tax;} else {return 0f;}}}

转载请注明原文地址:https://www.9cbs.com/read-69071.html

New Post(0)