Given the income of a person the tax is to calculate and display the payable tax according to the given chart.
- First ₹1 to ₹25,000 tax will be 0%
- Next ₹25,001 to ₹50,000 tax will be 5%
- Next ₹50,001 to ₹1,00,000 tax will be 7.5%
- Next ₹1,00,001 to ₹5,00,000 tax will be 10%
- Next ₹5,00,001 to ₹10,00,000 tax will be 12.5%
- Above ₹10,00,000 tax will be 15%
Java
import java.util.*;
public class IncomeTaxSlab
{
public static void main(String args[])
{
double income=0.0,tax=0.0;
Scanner sc=new Scanner(System.in);
System.out.print("Income: ");
income=sc.nextDouble();
if(income<=25000)
{
tax=0;
}
else if(income>25000&&income<=50000)
{
tax=0+((income-25000)*0.05);
}
else if(income>50000&&income<=100000)
{
tax=0+((50000-25000)*0.05)+((income-50000)*0.075);
}
else if(income>100000&&income<=500000)
{
tax=0+((50000-25000)*0.05)+((100000-50000)*0.075)+((income-100000)*0.1);
}
else if(income>500000&&income<=1000000)
{
tax=0+((50000-25000)*0.05)+((100000-50000)*0.075)+((500000-100000)*0.1)+((income-500000)*0.125);
}
else if(income>1000000)
{
tax=0+((50000-25000)*0.05)+((100000-50000)*0.075)+((500000-100000)*0.1)+((1000000-500000)*0.125)+((income-1000000)*0.15);
}
else
{
System.out.println("Amount of salary can't be non zero or negative");
}
System.out.println("Payable Tax: Rs "+tax);
}
}Java