$24
For this homework, you will write a program that calculates personal income tax based on the given tax rates reported by The Turkish Revenue Administration. The tax rates vary every year. We give you tax rates for the last 4 years (i.e., 2020, 2019, 2018, and 2017). The table below shows the tax rates for 2020.
Turkey Income Tax calculation (2020) :
Income (x)
Base
Tax rate
x < 22,000
0
15%
x < 49,000
for 22,000
3,300 TL
20%
x < 180,000
for 49,000
8,700 TL
27%
x < 600,000
for 180,000 44,070
35%
x >= 600,000
for 600,000 191,070
40%
The rules for this table is as follows:
• If the income is below 22,000TL, then this amount will be taxed at 15%.
• If the income is below 49,00TL, then the first 22,000TL is taxed as 3,300TL, and the other part will be taxed at 20%.
• If the income is below 180,000TL, then the first 49,000TL is taxed at 8,700TL, and the other part will be taxed at 27%.
• If the income is below 600,000TL, then the first 180,000TL is taxed at 44,070TL, and the other part will be taxed at 35%.
• If the income is equal or above 600,000TL, then the first 600,000TL is taxed at 191,070TL and the other part is taxed at 40%.
• As an example, if you have a taxable income of 40,000TL for 2020, the first 22,000TL is taxed as 3,300 TL, and the other 18,000 TL is taxed at 20%, so, your total tax is 6,900TL.
Likewise, the tax calculation tables for 2019, 2018, and 2017 are given, respectively.
Turkey Income Tax calculation (2019) :
Income (x)
Base
Tax rate
x < 18,000
0
15%
x < 40,000
for 18,000
2,700 TL
20%
x < 148,000
for 40,000
7,100 TL
27%
x < 500,000
for 148,000 36,260
35%
x >= 500,000
for 500,000 163,460
40%
Turkey Income Tax calculation (2018) :
Income (x)
Base
Tax rate
x < 14,800
0
15%
x < 34,000
for 14,800 2,220 TL
20%
x < 120,000
for 34,000 6,060 TL
27%
x >= 120,000
for 120,000 29,280
35%
Turkey Income Tax calculation (2017) :
Income (x)
Base
Tax rate
x < 13,000
0
15%
x < 30,000
for 13,000 1,950 TL
20%
x < 110,000
for 30,000 5,350 TL
27%
x >= 110,000
for 110,000 26,950
35%
Your program should take a year and an income value, based on it, it should report the income, the total tax amount, the income after tax, and the real tax rate applied to the income.
Example Runs:
Run 1:
2015 25000
Undefined year value!
Run 2:
2020 0
Income must be > 0!
Run 3:
2020 20000
Income: 20000.0
Tax amount: 3000.0
Income after tax: 17000.0
Real tax rate: 15.0%
Run 4:
2020 40500.75
Income: 40500.75
Tax amount: 7000.15
Income after tax: 33500.6
Real tax rate: 17.28%
Run 5:
2019 123456
Income: 123456.0
Tax amount: 29633.12
Income after tax: 93822.88
Real tax rate: 24.0%
Run 6:
2018 456789
Income: 456789.0
Tax amount: 147156.15
Income after tax: 309632.84
Real tax rate: 32.21%
Run 7:
2017 145500.75
Income: 145500.75
Tax amount: 39375.26
Income after tax: 106125.48
Real tax rate: 27.06%
Important Notes:
• Your program will be tested with an auto-grader. So it should take the input exactly the same in the example and it should print the output exactly the same in the example. Otherwise, your program may fail.
• You should exactly print the outputs with 2 digits after the decimal point.
• You shouldn’t print any messages before input taking.
• Your program should execute correctly for different test cases.
• Please do not write any package name at the beginning of your code!
Submission Instructions
Please zip and submit all your files using the filename YourNumberHW2.zip (ex: 150713852HW2.zip) to the Canvas system (under the Assignments tab). Your zip file should contain the followings:
1. Java source code (HW2_150713852.java)
2. Java class file (HW2_150713852.class)
Notes:
1. Write a comment at the beginning of each program to explain the purpose of the program. Write your name and student ID as a comment. Include necessary comments to explain your actions. Comments are very important for this homework.
2. Select meaningful names for your variables.
3. You are allowed to use the materials that you have learned in lectures & labs.
4. Do not use the things that you did not learn in the course.
5. Each student should submit his/her own homework. You can discuss with your peers about the homework but you are not allowed to exchange code or pseudocode. This also applies to material found on the web. Should some submitted homework assignments be identical or suspected to be identical, all involved parties will get a grade of ZERO from all homework. In case of any forms of cheating or copying, both giver and receiver are equally culpable and suffer equal penalties.
6. No late submission will be accepted.