calculate the total tax charged(According to different tax rate)

Calculate the total tax amount charged

This program is to calculate the total tax amount charged on the income of a person on the basis of given criteria.
Total Annual Taxable Income Tax Rate
Upto Rs.1,00,000 No tax
From 1,00,001 to 1,50,000 10% of the income exceeding Rs.1,00,000
From 1,50,000 to 2,50,000 Rs.5000 +20% of the income exceeding Rs.1,50,000
Above Rs.2,50,000 Rs.25,000 +30% of the income exceeding Rs.2,50,000

 import java.util.Scanner;

 public class Employee
{
      int pan; //declaring variable
      String name; //declaring variable
      double taxIncome//declaring variable
      double tax=0; //declaring variable

       public void input() //Creating Non return type input method
       {
            System.out.println("Enter pan number"); //Instruction to user
            pan= new Scanner(System.in).nextInt();

            System.out.println("Enter Name "); //Instruction to user
            name= new Scanner(System.in).next();

            System.out.println("Enter Taxable income"); //Instruction to user
            taxIncome= new Scanner(System.in).nextDouble();
       }
       
       public double calc() //Creating return type calc method
       {
            //Conditions according to above criteria
            if (taxIncome<=100000)
            {
                tax=0;
            }
            else if(taxIncome>100000 || taxIncome<150000)
            {
                tax=0.10*taxIncome;
            }
            else if(taxIncome>=150000 || taxIncome<=250000)
            {
                tax=0.20*(taxIncome-150000)+5000;
               
            }
            else
            {
                tax=0.30*(taxIncome-250000)+25000;
               
             }
                return tax;
        }
        public void details() //creating non-return type details method
        {
              System.out.println("Pan no        Name      Tax Income       Tax");
              System.out.println(pan+"        "+name+"   "+taxIncome+"    "+tax);
         }

         public static void main(String []args) //Developing main method
         {
              Employee obj=new Employee(); //Creating 'obj' object of Employee class
              obj.input()//Calling input method
              obj.calc()//Calling calc method
              obj.details()//Calling details method
         }
  }


Output:


   Enter pan number
   899762
   Enter Name 
   Prajwal Ghimire
   Enter Taxable income
   265000

   Pan no        Name      Tax Income       Tax
   899762        Prajwal   265000.0    26500.0

Comments

Popular posts from this blog

Java program using Scanner Class

Java Program to make a comparison between numbers

Calculate the area of Rectangle Using Constructor Overloading rules