Tuesday, February 18

Income Tax calculation using If Else Functionality in Java



Hi ALL,

Here I wrote a program for simple Income Tax calculation using If Else Functionality in Java.


/**
 *
 * @author Balamurgan M
 */
import java.util.Scanner;

public class AmericanTaxCalc {
    public static void main(String arg[]){
        System.out.println("US federal person income tax");
        System.out.println("Please fill your status example \n 0.Single \n 1.Married "
                + "Filling Joinly \n 2.Married filling separatly \n 3.Head of household");
        Scanner in=new Scanner(System.in);
        int status=in.nextInt();
        if(status == 0){
            System.out.println("Please enter your annual income :\t$");
            int Aincome=in.nextInt();
            if(Aincome<8350)
                System.out.println(" Your tax amt is : $"+(Aincome*10)/100);
            else if((Aincome>8351)&&(Aincome<=33950))
                 System.out.println(" Your tax amt is : $"+(Aincome*15)/100);
            else if((Aincome>33951)&&(Aincome<=82250))
                 System.out.println(" Your tax amt is : $"+(Aincome*25)/100);
            else if((Aincome>82251)&&(Aincome<=171550))
                 System.out.println(" Your tax amt is : $"+(Aincome*28)/100);
            else if((Aincome>171551)&&(Aincome<=372950))
                 System.out.println(" Your tax amt is : $"+(Aincome*33)/100);
           else
                System.out.println(" Your tax amt is : $"+(Aincome*35)/100);
        }else if(status ==1){
            System.out.println("Please enter your annual income :\t$");
            int Aincome=in.nextInt();
            if(Aincome<16700)
                System.out.println(" Your tax amt is : $"+(Aincome*10)/100);
            else if((Aincome>16701)&&(Aincome<=67900))
                 System.out.println(" Your tax amt is : $"+(Aincome*15)/100);
            else if((Aincome>67901)&&(Aincome<=137050))
                 System.out.println(" Your tax amt is : $"+(Aincome*25)/100);
            else if((Aincome>137051)&&(Aincome<=208850))
                 System.out.println(" Your tax amt is : $"+(Aincome*28)/100);
            else if((Aincome>208851)&&(Aincome<=372950))
                 System.out.println(" Your tax amt is : $"+(Aincome*33)/100);
           else
                System.out.println(" Your tax amt is : $"+(Aincome*35)/100);
           
        }else if(status ==2){
            System.out.println("Please enter your annual income :\t$");
            int Aincome=in.nextInt();
            if(Aincome<8350)
                System.out.println(" Your tax amt is : $"+(Aincome*10)/100);
            else if((Aincome>8351)&&(Aincome<=33950))
                 System.out.println(" Your tax amt is : $"+(Aincome*15)/100);
            else if((Aincome>33951)&&(Aincome<=68525))
                 System.out.println(" Your tax amt is : $"+(Aincome*25)/100);
            else if((Aincome>68526)&&(Aincome<=104425))
                 System.out.println(" Your tax amt is : $"+(Aincome*28)/100);
            else if((Aincome>104426)&&(Aincome<=186475))
                 System.out.println(" Your tax amt is : $"+(Aincome*33)/100);
           else
                System.out.println(" Your tax amt is : $"+(Aincome*35)/100);
           
        }else if(status ==3){
             System.out.println("Please enter your annual income :\t$");
            int Aincome=in.nextInt();
            if(Aincome<11950)
                System.out.println(" Your tax amt is : $"+(Aincome*10)/100);
            else if((Aincome>11951)&&(Aincome<=45550))
                 System.out.println(" Your tax amt is : $"+(Aincome*15)/100);
            else if((Aincome>45551)&&(Aincome<=117450))
                 System.out.println(" Your tax amt is : $"+(Aincome*25)/100);
            else if((Aincome>117451)&&(Aincome<=190200))
                 System.out.println(" Your tax amt is : $"+(Aincome*28)/100);
            else if((Aincome>190201)&&(Aincome<=372950))
                 System.out.println(" Your tax amt is : $"+(Aincome*33)/100);
           else
                System.out.println(" Your tax amt is : $"+(Aincome*35)/100);
           
        }else
            System.out.println("You are entered wrong input");
       
       
    }
   
}

No comments:

Post a Comment

Backup files to google drive using PHP coding

 Dear All, To backup files to Google Drive using PHP coding, you can use the Google Drive API and the Google Client Library for PHP. Here...