Java program that computes income tax
###### Posted by Samath
Last Updated: May 08, 2021

The original U.S. income tax of 1913 was quite simple. The tax was
• 1 percent on the first \$50,000.
• 2 percent on the amount over \$50,000 up to \$75,000.
• 3 percent on the amount over \$75,000 up to \$100,000.
• 4 percent on the amount over \$100,000 up to \$250,000.
• 5 percent on the amount over \$250,000 up to \$500,000.
• 6 percent on the amount over \$500,000.
There was no separate schedule for single or married taxpayers.
Write a program that computes the income tax according to this schedule.

Code:

```import java.util.Scanner;

public class Main
{
public static void main(String[] args) {

Scanner input = new Scanner(System.in);
double income;
double tax;

income = input.nextDouble();
input.close();
tax = 0;
if (income < 1) {
System.out.println("Income must be greater than 0");
return;
}
else if (income <= 50000) {
tax = income * 0.01;
}
else if (income <= 75000) {
tax = income * 0.02;
}
else if (income <= 100000) {
tax = income * 0.02;
}
else if (income <= 250000) {
tax = income * 0.04;
}
else if (income <= 500000) {
tax = income * 0.05;
}
else {
tax = income * 0.06;
}
System.out.println("Your tax is: " + tax);
}
}
```
###### Java program that asks the user for a year and computes whether that year is a leap year
Samath | May 08, 2021
###### C++ program that computes and displays the charges for a patient’s hospital stay
Samath | Jan 06, 2021
###### C program that prompts the user for a positive integer and then computes the sum of all the digits of the number
Samath | May 04, 2016
###### Java program that computes and displays the perimeter of a letter­size (8.5 × 11 inch) sheet of paper and the length of its diagonal
Samath | Feb 08, 2021
###### Java program that computes the sum, difference, product, average, distance, maximum and minimum of two numbers
Samath | Feb 08, 2021