0% found this document useful (0 votes)
62 views2 pages

Income Tax

The document describes a Java program that calculates income tax based on a user's entered income. The program uses if/else statements to determine tax rates for different income brackets and returns the calculated tax amount.

Uploaded by

david johnson
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views2 pages

Income Tax

The document describes a Java program that calculates income tax based on a user's entered income. The program uses if/else statements to determine tax rates for different income brackets and returns the calculated tax amount.

Uploaded by

david johnson
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Income Tax

/*
* Main.java
*
* Created on October 27, 2008, 9:05 PM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/

package incometax;
import java.text.*;

/**
*
* @author david johnson
*/
public class Main {

/** Creates a new instance of Main */


public Main() {
}

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
System.out.println("Please enter your income: ");
double income = MyInput.readDouble();
double incomeTax = calculateIncomeTax(income);
NumberFormat currency = NumberFormat.getCurrencyInstance();
System.out.println("The income tax is: " + currency.format(incomeTax));

public static double calculateIncomeTax(double income)


{
double tax = 0;
if (income <= 750)
{
tax = income * .01;
}
else if(income <= 2250)
{
tax = 7.5 + (income - 750) * 0.02;
}
else if(income <= 3750)
{
tax = 37.50 + (income - 2250)* .03;
}
else if(income <= 5250)
{
tax = 82.50 + (income - 3750)* .04;

}
else if(income <= 7000)
{
tax = 142.50 + (income - 5250)* .05;

}
else
{
tax = 230.0 + (income - 7000)*.06;
}

return tax;
}

You might also like