coding solution and publishing

 

New Tax Regime coding solutions:

import java.util.Scanner;


public class NewTaxRegime{
public static void main(String[] args){
double income,resultA, resultB;
final double taxA=12500;
final double taxB=37500;
final double taxC=75000;
final double taxD=125000;
final double taxE=187500;
final double incomeA =250000;
final double incomeB =500000;
final double incomeC =750000;
final double incomeD =1000000;
final double incomeE =1250000;
final double incomeF =1500000;
System.out.println("Enter your Anully Income :");
try (Scanner obj = new Scanner(System.in)) {
  income = obj.nextDouble();
}
//Income <= 250000 Tax zero
if(income <= incomeA){
  System.out.print("Your income is Rs "+income+ " and you are Exempt from Income Tax..");
  // Income <=500000 Tax 5%
}else if (income > incomeA  && income<= incomeB) {
  resultA=(double)(income-incomeA);
  resultB=(double)(resultA*0.05);
  System.out.println("Your income is RS "+income+ " and your Income Tax is " +resultB);
  //Income <=750000 Tax 12500 + 10%
} else if(income > incomeB && income <= incomeC){
  resultA=(double)(income-incomeB);
  resultB=(double)(resultA*0.10 + taxA);
  System.out.println("Your income is RS "+income+ " and your Income Tax is RS " +resultB);
  //Income <=1000000 Tax 37500 + 15%
}else if(income > incomeC && income <= incomeD){
    resultA=(double)(income-incomeC);
    resultB=(double)(resultA*0.15 + taxB);
    System.out.println("Your income is RS "+income+ " and your Income Tax is RS " +resultB);
    //Income <=1250000 Tax 75000 + 20%
}else if(income > incomeD && income <= incomeE){
    resultA=(double)(income-incomeD);
    resultB=(double)(resultA*0.20 + taxC);
    System.out.println("Your income is RS "+income+ " and your Income Tax is RS " +resultB);
    //Income <=1500000 Tax 125000 + 25%
}else if(income > incomeE && income <= incomeF){
    resultA=(double)(income-incomeE);
    resultB=(double)(resultA*0.25 + taxD);
    System.out.println("Your income is RS "+income+ " and your Income Tax is RS " +resultB);  
     //Income > 1500000 Tax 150000 + 30%    
}else{
  resultA=(double)(income-incomeF);
  resultB=(double)(resultA*0.30 + taxE);
  System.out.println("Your income is RS "+income+ " and your Income Tax is RS " +resultB);
}
}
}

Comments