Question

The United States federal personal income tax is calculated based on filing status and taxable income....

The United States federal personal income tax is calculated based on filing status and taxable income. There are four filing statuses: single filers, married filing jointly, married filing separately, and head of household. The tax rates vary every year. Table 3.2 shows the rates for 2009. If you are, 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 tax is $1,082.5.

Table 1

2009 U.S. Federal Personal Tax Rates

Marginal Tax Rate

Single

Married Filing Jointly or Qualified Widow(er)

Married Filing Separately

Head of Household

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,525 – $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+

You are to write a program to compute personal income tax. Your program should prompt the user to enter the filing status and taxable income and compute the tax. Enter 0 for single filers, 1 for married filing jointly, 2 for married filing separately, and 3 for head of household.

Here are sample runs of the program:

Sample 1:

Enter the filing status: 0

Enter the taxable income: 100000

Tax is 21720.0

Sample 2:

Enter the filing status: 1

Enter the taxable income: 300339

Tax is 76932.87

Sample 3:

Enter the filing status: 2

Enter the taxable income: 123500

Tax is 29665.5

Sample 4:

Enter the filing status: 3

Enter the taxable income: 4545402

Tax is 1565250.7

Analysis:

(Describe the problem including input and output in your own words.)

Design:

(Describe the major steps for solving the problem.)

Homework Answers

Answer #1

JAVA PROGRAM

import java.util.Scanner;

/**
*
* Class: PersonlaIncomeTaxCalculator
*
*/
public class PersonlaIncomeTaxCalculator {
  
   private static final String[] FILLING_STATUS = {"single filers","married filing jointly","married filing separately","head of household"};
   private static final double[] TAX_RATES = {0.1,0.15,0.25,0.28,0.33,0.35};
  
   //The below 2D double array is created to hold upper tax bracket limit for each of tax rates which has upper limit
   //0th row of 2d array represents upper tax bracket for 10% tax rate, 1st row represents for 15% tax rate and so on
   //Each column of 2d array represent the upper tax bracket for a particular filling status
   //for example TAX_BRACKETS[1][2] will represent: upper tax bracket limit (33950) of "married filing separately" for 15% tax rate
   //for example TAX_BRACKETS[3][3] will represent: upper tax bracket limit (190200) of "head of household" for 28% tax rate
   //and so on..
   private static final double[][] TAX_BRACKETS = {    {8350,16700,8350,11950}, //upper limit of tax bracket for 10% tax
                                                       {33950,67900,33950,45500}, //upper limit of tax bracket for 15% tax
                                                       {82250,137050,68525,117450},//upper limit of tax bracket for 25% tax
                                                       {171550,208850,104425,190200},//upper limit of tax bracket for 28% tax
                                                       {372950,372950,186475,372950}//upper limit of tax bracket for 33% tax
                                                       //no upper limit for 35% tax rate(hence row for this not added here)
                                               };
                                          
  
   //MAIN PROGRAM
   public static void main(String[] args){
       Scanner sc = new Scanner(System.in);//user input scanner
         
       System.out.println("Personal Income Tax Calculator");
       System.out.println("===============================");
         
       //print the filling status
       for(int i = 0 ; i < FILLING_STATUS.length ; i++){
           System.out.println("Enter "+i+" for "+FILLING_STATUS[i]);
       }
         
       int choice = -1;
       do{
           System.out.println("Enter your choice:");
           choice = sc.nextInt();
           if(choice <0 || choice > 3){
               System.out.println("Invalid Input.Please try again!");
           }else{
               break;
           }
       }while(true);//try as long as valid input is not given
         
       System.out.println("Enter the taxable income:");
       double taxableIncome = sc.nextDouble();//enter taxable total income
         
       double tax = calculateTax(choice, taxableIncome);//calculate tax
         
       System.out.println("Tax is: "+tax);//print tax
   }
  
   /**
   * Calculate tax based on choice and the taxable income
   * @param choice
   * @param taxableIncome
   * @return
   */
   private static double calculateTax(int choice, double taxableIncome){
       double totalTax = 0;
       double currentLowerLimit = 0;
       boolean checkAgain = false;
       int i = 0;
      
       //loop till last but one tax rate(33%) (hence i < TAX_RATES.length -1)
       //as the last one has no upper limit

       for(i = 0; i < TAX_RATES.length -1; i++){
           double currentUpperLimit = TAX_BRACKETS[i][choice];//get current upper limit
           double currentTaxRate = TAX_RATES[i];//get tax rate
          
           double applicableAmountForCurrentTaxRate = 0;
          
           //calculating the amount on which current tax rate will be applicable
           if(taxableIncome >= currentUpperLimit){  
               applicableAmountForCurrentTaxRate = currentUpperLimit - currentLowerLimit;
               checkAgain = true;//as there is some more tax amount to be taxed at next tax rate
           }else{
               applicableAmountForCurrentTaxRate = taxableIncome - currentLowerLimit;
               checkAgain = false;//as there is no more tax amount on which next tax rate can be applied      
           }
          
           //calculate tax and add it with previous totalTax
           totalTax = totalTax + (applicableAmountForCurrentTaxRate*currentTaxRate);
          
           if(checkAgain){//adjust the lower limit
               currentLowerLimit = currentUpperLimit;
           }else{
               //break out of the loop is furthr check is not needed
               break;
           }
       }
      
       //outside for loop:
       //if checkAgain still remains true, it means check for last tax rate(35%)
       //int variable i at this point will also point to last index of TX_RATES
       if(checkAgain){
           totalTax = totalTax + (taxableIncome - currentLowerLimit)* TAX_RATES[i];
       }
      
       return totalTax;
   }

}

==================================

OUTPUT

==================================

Run1

Personal Income Tax Calculator
===============================
Enter 0 for single filers
Enter 1 for married filing jointly
Enter 2 for married filing separately
Enter 3 for head of household
Enter your choice:
0
Enter the taxable income:
100000
Tax is: 21720.0

Run2

Personal Income Tax Calculator
===============================
Enter 0 for single filers
Enter 1 for married filing jointly
Enter 2 for married filing separately
Enter 3 for head of household
Enter your choice:
1
Enter the taxable income:
300339
Tax is: 76932.87

Run3

Personal Income Tax Calculator
===============================
Enter 0 for single filers
Enter 1 for married filing jointly
Enter 2 for married filing separately
Enter 3 for head of household
Enter your choice:
2
Enter the taxable income:
123500
Tax is: 29665.5

Run4

Personal Income Tax Calculator
===============================
Enter 0 for single filers
Enter 1 for married filing jointly
Enter 2 for married filing separately
Enter 3 for head of household
Enter your choice:
3
Enter the taxable income:
4545402
Tax is: 1565250.7

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
4. Calculating taxable income For 2016, the personal exemption amount is $4,050. The 2016 standard deduction...
4. Calculating taxable income For 2016, the personal exemption amount is $4,050. The 2016 standard deduction is $6,300 for unmarried taxpayers or married taxpayers filing separately, $12,600 for married taxpayers filing jointly, and $9,300 for taxpayers filing as head of household. Calculating Lynn’s Taxable Income Lynn is an unmarried person filing single. Calculate Lynn’s 2016 taxable income by filling in the worksheet. Enter adjustments, deductions, and exemptions as negative numbers. If your answer is zero, enter "0". • Lynn will...
Rates for a married taxpayer filing separately are 10% of taxable income up to $8,375 and...
Rates for a married taxpayer filing separately are 10% of taxable income up to $8,375 and 15% thereafter up to $34,000. Rates for a couple filing a joint return are 10% of taxable income up to $16,750 and 15% thereafter up to $68,000. Miller and Laura Collins are figuring their tax both ways for comparison before deciding which way to file. Miller earned $20,000 and Laura earned $40,000. The standard deduction for a married couple filing jointly is $11,400. The...
1: Paul Robinson's filing status is married filing jointly, and he has earned gross pay of...
1: Paul Robinson's filing status is married filing jointly, and he has earned gross pay of $2,850. Each period he makes a 403(b) contribution of 6.5% of gross pay . His current year taxable earnings for Medicare tax, to date, are $271,000. Total Medicare Tax = $ 2: Stephen Belcher's filing status is single, and he has earned gross pay of $1,860. Each period he makes a 401(k) contribution of 9% of gross pay and contributes 1% of gross pay...
A person is Filing taxes as "Married filing Jointly". There taxable income is 141782. They have...
A person is Filing taxes as "Married filing Jointly". There taxable income is 141782. They have 4 personal exemptioons 1.What is the formula to to find the tax amount? 2. What is the tax amount____________? Please use 2016 tax tables and formulas.
a. Wally Megabucks had taxable income of $356,798. Determine his 2019 federal tax liability. b. His...
a. Wally Megabucks had taxable income of $356,798. Determine his 2019 federal tax liability. b. His wife Tilly, had taxable income of $45,098. Determine her federal tax liability. c. Determine their joint tax liability married filing jointly and filing separately.
For 2016, the personal exemption amount is $4,050. The 2016 standard deduction is $6,300 for unmarried...
For 2016, the personal exemption amount is $4,050. The 2016 standard deduction is $6,300 for unmarried taxpayers or married taxpayers filing separately, $12,600 for married taxpayers filing jointly, and $9,300 for taxpayers filing as head of household. Calculating Austin and Joseph’s Taxable Income Austin and Joseph are a married couple filing jointly. Calculate Austin and Joseph’s 2016 taxable income by filling in the worksheet. Enter adjustments, deductions, and exemptions as negative numbers. If your answer is zero, enter "0". •...
Determine the tax liability for tax year 2019 in each of the following instances. In each...
Determine the tax liability for tax year 2019 in each of the following instances. In each case, assume the taxpayer can take only the standard deduction. Use the appropriate Tax Tables and Tax Rate Schedules. a. A single taxpayer, not head of household, with AGI of $23,493 and one dependent. b. A single taxpayer, not head of household, with AGI of $169,783 and no dependents. (Round your intermediate computations to 2 decimal places and final answer to the nearest dollar...
a. What are the tax liability, the marginal tax rate, and the average tax rate for...
a. What are the tax liability, the marginal tax rate, and the average tax rate for a married couple filing jointly with $68,900 taxable income? b. What are the tax liability, the marginal tax rate, and the average tax rate for a single individual with $214,200 taxable income? c. What are the tax liability, the marginal tax rate, and the average tax rate for a head of household with $463,300 taxable income?
a. What are the tax liability, the marginal tax rate, and the average tax rate for...
a. What are the tax liability, the marginal tax rate, and the average tax rate for a married couple filing jointly with $68,900 taxable income? b. What are the tax liability, the marginal tax rate, and the average tax rate for a single individual with $214,200 taxable income? c. What are the tax liability, the marginal tax rate, and the average tax rate for a head of household with $463,300 taxable income?
#49 – Eric is single and has no dependents for 2019. He earned $60,000 and had...
#49 – Eric is single and has no dependents for 2019. He earned $60,000 and had deductions from gross income of $1,800 and itemized deductions of $12,400. Compute Eric’s income tax for the year using the Tax Rate Schedules.                #50 – Allen has taxable income of $75,475 for 2019. Using the Tax Rate Schedules in the Appendix, compute Allen’s income tax liability before tax credits and prepayments for each of the following filing statuses. Married filing jointly               Married...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT