「java个人所得税」java个人所得税计算例题

博主:adminadmin 2023-01-09 18:15:07 745

本篇文章给大家谈谈java个人所得税,以及java个人所得税计算例题对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。

本文目录一览:

用java编写个人所得税,超过1600元要纳税

public static void main(String[] args) {

    System.out.println("输入你的收入:");

    Scanner input = new Scanner(System.in);

    double money = input.nextFloat();

    double tax = 0;

  

    if(money = 500){

        tax = money * 0.05;

    }else if(money  500  money = 20000){

        tax = money * 0.1;

    }

    // .....

    System.out.println("纳税:" + tax + " 元");

}

怎样用java编写个人所得税公式呀?

java计算个税例子:

/**

* @author Kun Sun

* @Date: 2013.10.15

*/

public class Employee { // 雇员类

private String ID;       // ID

private String name;     // 姓名

private int salary;      // 工资薪金所得

private int insureHome;  // “五险一金”数额

private int deduct;      // 扣除数额

Employee(){

}

Employee(String ID,String name){ // 带参数的构造方法

this.ID = ID;

this.name = name;

}

Employee(String ID,String name,int salary,int insureHome,int deduct){  // 带参数的构造方法

this.ID = ID;

this.name = name;

this.salary = salary;

this.insureHome = insureHome;

   this.deduct = deduct;

}

public String getID() {

return ID;

}

public String getName() {

return name;

}

public int getSalary() {

return salary;

}

public int getInsureHome() {

return insureHome;

}

public int getDeduct() {

return deduct;

}

public void setID(String iD) {

ID = iD;

}

public void setName(String name) {

this.name = name;

}

public void setSalary(int salary) {

this.salary = salary;

}

public void setInsureHome(int insureHome) {

this.insureHome = insureHome;

}

public void setDeduct(int deduct) {

this.deduct = deduct;

}

public void selfValue(){ // 个人所得税具体计算

double sefValue;

   if(salary=0 salary1500){

    sefValue = (double)(salary-insureHome-deduct)*0.03 - 0;

   }else if(salary=1500 salary4500){

    sefValue = (double)(salary-insureHome-deduct)*0.1 - 105;

   }else if(salary=4500 salary9000){

    sefValue = (double)(salary-insureHome-deduct)*0.2 - 555;

   }else if(salary=9000 salary35000){

    sefValue = (double)(salary-insureHome-deduct)*0.25 - 1005;

   }else if(salary=35000 salary55000){

    sefValue = (double)(salary-insureHome-deduct)*0.30 - 2755;

   }else if(salary=55000 salary80000){

    sefValue = (double)(salary-insureHome-deduct)*0.35 - 5505;

   }else{

    sefValue = (double)(salary-insureHome-deduct)*0.45 - 13505;

   }

   System.out.println(sefValue);

}

}

// 用于测试雇员类

public class MainClass {

/**

* @param args

*/

public static void main(String[] args) {

// TODO Auto-generated method stub

System.out.println("第一种调用方法:");

Employee emp = new Employee("1001","Sun");

emp.setSalary(12345);

emp.setInsureHome(890);

emp.setDeduct(55);

System.out.println("编号为"+emp.getID()+",姓名是"+emp.getName()+" 的应纳税额是:");

   emp.selfValue();

 

   System.out.println("------------------------\n第二种调用方法:");

   Employee emp2 = new Employee("1001","Sun",12345,890,55);

System.out.println("编号为"+emp2.getID()+",姓名是"+emp2.getName()+" 的应纳税额是:");

   emp2.selfValue();

 

   System.out.println("------------------------\n第二种调用方法:");

   Employee emp3 = new Employee();

   emp3.setID("1001");

   emp3.setName("Sun");

emp3.setSalary(12345);

emp3.setInsureHome(890);

emp3.setDeduct(55);

System.out.println("编号为"+emp3.getID()+",姓名是"+emp3.getName()+" 的应纳税额是:");

   emp3.selfValue();

}

}

运行结果:

Java设置实现分段计算员工应交的个人所得税

因为题中说的是“收入的x%”,所以个税计算都是直接算的总收入的x% 而不是按现实中实际的超出部分的x%计算,特此说明

public class Test {

    public static void main(String[] args) {

        double income = 6000;

        double tax = tax(income);

        System.out.println("收入" + income + "时应交个人所得税为" + tax);

    }

    public static double tax(double x) {

        double y;

        if (x  3000) {

            y = 0;

        } else if (x = 5000) {

            y = x * 0.05;

        } else if (x = 10000) {

            y = x * 0.1;

        } else {

            y = x * 0.2;

        }

        return y;

    }

}

java个人所得税的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于java个人所得税计算例题、java个人所得税的信息别忘了在本站进行查找喔。