I have been asked to solve this problem:
We want to compute the yearly and monthly rate of taxes to be paid by a person earning a given gross yearly salary, knowing the rates for NI contributions, pension contributions, and income tax. We shall use imaginary figures, not real rates.
The salary is input from the keyboard.
The NI contribution is calculated as 6% of the gross salary.
The pension contribution is calculated as 2% of the gross salary.
The income tax is computed progressively after detracting NI and pension contributions. The taxable amount (after detractions) is divided into bands, each taxed at a different rate as follows:
Gross yearly income: Tax rate:
0 - 4000 0% on first 4000
4001 – 15000 17% on next 10999
15001 – 30000 25% on next 14999
30001 and above 40% on any remainder
For example, if the gross yearly salary is 32,588, then the yearly contributions are 1955.28 (NI) and 651.76 (pension), and the income tax is applicable to
32588-(1955.28+651.76 ) = 29980.96.
The total yearly income tax is 0+1869.93+3745. 49 = 5614.92:
0 on the first 4000 (leaving 25980.96 to tax), plus
17% on the second 10999 = 1869.93 (leaving 14981.96 to tax), plus
25% on the remaining 14981.96 = 3745.49 (as 14981.96 smaller than 14999)
The session must look like this (including the tabular structure and alignment):
Input gross yearly salary: 32,588
Contributions:
Monthly Yearly
NI 162.94 1955.28
Pension 54.31 651.76
Taxable amount after detractions: 29980.96
Tax due 467.91 5614.92
I have done everything except there seems to be a few errors when i'm working out the tax due. Could someone help please!!
Everything is correct before this point, I think i may just have a small syntax error somewhere but can't find the exact solution
This is my tax code:
Thanks for any help
We want to compute the yearly and monthly rate of taxes to be paid by a person earning a given gross yearly salary, knowing the rates for NI contributions, pension contributions, and income tax. We shall use imaginary figures, not real rates.
The salary is input from the keyboard.
The NI contribution is calculated as 6% of the gross salary.
The pension contribution is calculated as 2% of the gross salary.
The income tax is computed progressively after detracting NI and pension contributions. The taxable amount (after detractions) is divided into bands, each taxed at a different rate as follows:
Gross yearly income: Tax rate:
0 - 4000 0% on first 4000
4001 – 15000 17% on next 10999
15001 – 30000 25% on next 14999
30001 and above 40% on any remainder
For example, if the gross yearly salary is 32,588, then the yearly contributions are 1955.28 (NI) and 651.76 (pension), and the income tax is applicable to
32588-(1955.28+651.76 ) = 29980.96.
The total yearly income tax is 0+1869.93+3745. 49 = 5614.92:
0 on the first 4000 (leaving 25980.96 to tax), plus
17% on the second 10999 = 1869.93 (leaving 14981.96 to tax), plus
25% on the remaining 14981.96 = 3745.49 (as 14981.96 smaller than 14999)
The session must look like this (including the tabular structure and alignment):
Input gross yearly salary: 32,588
Contributions:
Monthly Yearly
NI 162.94 1955.28
Pension 54.31 651.76
Taxable amount after detractions: 29980.96
Tax due 467.91 5614.92
I have done everything except there seems to be a few errors when i'm working out the tax due. Could someone help please!!
Everything is correct before this point, I think i may just have a small syntax error somewhere but can't find the exact solution
This is my tax code:
Code:
if (taxable <= 4000) { tax = 0 ; } else { tax = 0; taxable = taxable - 4000 ; } if (taxable <= 15000) { tax = taxable*17/100; } else { tax = tax + (10999*17/100); taxable = taxable - 10999; } if (taxable <=30000) { tax = tax + taxable*25/100; } else { tax = tax + (14999*25/100); taxable = taxable - 14999 ; } if (taxable >= 30001 ) { tax = tax + taxable*40/100 ; } taxmo = tax/12;
Comment