Description
The following workshop lets you practice basic java coding techniques, creating classes, methods, using arrays. Task 1: The Canadian federal personal income tax is calculated based on filing status and taxable income. There are four filing statuses: • single filers • married filing jointly or qualified widow(er) • married filing separately • head of household. The tax rates vary every year. If you are, for example say, single with a taxable income of $10,000, the first $8,350 is taxed at 10% and the other $1,650 is taxed at 15%, so, your total tax is $1,082.50. Design a class named IncomeTax to contain the following instance data fields (Chose the data fields types on your own): 1. filingStatus: One of the four tax-filing statuses: • 0—single filer • 1— married filing jointly or qualifying widow(er) • 2—married filing separately • 3—head of household. 2. Use the constants • SINGLE_FILER(0) • MARRIED_JOINTLY_OR_QUALIFYING_WIDOW(ER) (1) • MARRIED_SEPARATELY (2) • HEAD_OF_HOUSEHOLD (3) to represent the statuses. 3. A double-dimension array (You decide the type of it) named intervals: Stores the tax intervals/ brackets for each filing status. 4. A single-dimension array (You decide the type) named rates: Stores the tax rates for each interval. 5. A variable taxableIncome: Stores the taxable income. 6. Provide the getter and setter methods for each data field and the getIncomeTax() method that returns the tax. 7. Provide a no-arg constructor. JAC – 444 Semester ——— 8. Provide the overloaded constructor IncomeTax(filingStatus, intervals, rates, taxableIncome). Write a program that prompt the user with a simple menu system of three choices: • Compute personal income Tax • Print the tax tables for taxable incomes (with range) • Exit ❖ With choice one your program should prompt the user to enter the filing status and taxable income and compute the tax. ❖ With choice two your program should use the IncomeTax class to print the 2001 and 2009 tax tables for taxable income from (ask the user to input the amount) to (ask the user to input the amount) with intervals of $1,000 for all four statuses. The tax rates for the year 2001 and 2009 are given in Tables below. Table 1: 2001 Canadian Federal Personal Tax Rates Tax Rate Single Married Filing Jointly or Qualifying Widow(er) Married Filing Separately Head of House Hold 15% Up to – $27,050 Up to – $45,200 Up to $22,600 Up to – $36,250 27.5% $27,051 – $65,550 $45,201 – $109,250 $22,601 – $54,625 $36,251 – $93,650 30.5% $65,551-$136,750 $109,251 – $166,500 $54,626 – $83,250 $93,651 – $151,650 35.5% $136,751-$297,350 $166,501 – $297,350 $83,251 – $148,675 $151,651 – $297,350 39.1% $297,351 + $297,351 + $148,676+ $297,351+ Table 2: 2009 Canadian Federal Personal Tax Rates Marginal Tax Rate Single Married Filing Jointly or Qualifying Widow(er) Married Filing Separately Head of House Hold 10% $0 – $8,350 $0 – $16,700 $0 – $8,350 $0 – $11,950 15% $8,351 – $33,950 $16,701 – $67,900 $8,351 – $33,950 $11,951 – $45,500 25% $33,951-$82,250 $67,901 – $137,050 $33,951 – $68,525 $45,501 – $117,450 28% $82,251-$171,550 $137,051 – $208,850 $68,526 – $104,425 $117,451 – $190,200 33% $171,551-$372,950 $208,851 – $372,950 $104,426 – $186,475 $190,201 – $372,950 35% $372,951 + $372,951 + $186,476 + $372,951 + For each filing status there are six tax rates. Each rate is applied to a certain amount of taxable income. For example, of a taxable income of $400,000 for single filers, $8,350 is taxed at 10%, (33,950 – 8,350) at 15%, (82,250 – 33,950) at 25%, (171,550 – 82,250) at 28%, (372,950 – 171,550) at 33%, and (400,000 – 372,950) at 35%. Continue to the next page…. JAC – 444 Semester ——— Possible output screen shots: With choice 1: With choice 2: Continue to the next page… 0 – single filer 1 – married jointly or qualifying widow(er) 2 – married separately 3 – head of household) Enter the filing status: 0 Enter the Taxable Income: $20000 Tax is: $2582.50 JAC – 444 Semester ——— Enter the amount From: $50000 Enter the amount To: $60000 2001 tax tables for taxable income from $50,000 to $60,000 ———————————————————————————- Taxable Single Married Joint Married Head of Income or Qualifying Separate a House Widow(er) ———————————————————————————- 50000 10368.75 8100.00 10925.00 9218.75 51000 10643.75 8375.00 11200.00 9493.75 52000 10918.75 8650.00 11475.00 9768.75 53000 11193.75 8925.00 11750.00 10043.75 54000 11468.75 9200.00 12025.00 10318.75 55000 11743.75 9475.00 12311.25 10593.75 56000 12018.75 9750.00 12616.25 10868.75 57000 12293.75 10025.00 12921.25 11143.75 58000 12568.75 10300.00 13226.25 11418.75 59000 12843.75 10575.00 13531.25 11693.75 60000 13118.75 10850.00 13836.25 11968.75 2009 tax tables for taxable income from $50,000 to $60,000 ——————————————————————————— Taxable Single Married Joint Married Head of Income or Qualifying Separate a House Widow(er) ——————————————————————————— 50000 8687.50 11905.70 8687.50 7352.50 51000 8937.50 12235.70 8937.50 7602.50 52000 9187.50 12565.70 9187.50 7852.50 53000 9437.50 12895.70 9437.50 8102.50 54000 9687.50 13225.70 9687.50 8352.50 55000 9937.50 13555.70 9937.50 8602.50 56000 10187.50 13885.70 10187.50 8852.50 57000 10437.50 14215.70 10437.50 9102.50 58000 10687.50 14545.70 10687.50 9352.50 JAC – 444 Semester ——— Possible UML diagram for the class IncomeTax (You can add more functionalities or properties/ attributes) Continue to the next page… IncomeTax -filingStatus: int +SINGLE_FILER: int ————————– +MARRIED_JOINTLY_OR_QUALIFYING_WIDOW(ER): int ————————————————————————– +MARRIED_SEPARATELY: int ————————————————————————– +HEAD_OF_HOUSEHOLD: int —————————————- -intervals: int[][] -rates: double[] -taxableIncome: double +IncomeTax() +IncomeTax(filingStatus: int, Intervals: int[][], rates: double[], taxableIncome: double) +getFilingStatus(): int +setFilingStatus(status: int) +getIntervals(): int[][] +setIntervals(Intervals: int[][]) +getRates(): int[] +setRates(rates: int[]) +getTaxableIncome(): double +setTaxableIncome(taxableIncome: double) +getIncomeTax(): double JAC – 444 Semester ——— Workshop Header /********************************************** Workshop # Course: – Semester Last Name: First Name: ID: Section: