编写个人所得税计算程序

import java.util.ArrayList;

public class test1114 {
    public static void main(String[] args) {
        double tax = 0.0;
        ArrayList<Employee> employees = new ArrayList<>();
        Employee employee1 = new Employee("小明",2500);
        Employee employee2 = new Employee("小军",8000);
        Employee employee3 = new Employee("小红",100000);
        employees.add(employee1);
        employees.add(employee2);
        employees.add(employee3);
        for (int i = 0; i <= employees.size()-1 ; i++) {
            double income = employees.get(i).getSalary() - 3500;
            if (income < 0.0){
                tax = 0.0;
            } else if (income <= 1500) {
                tax = income * 0.03;
            } else if (income <= 4500) {
                tax = income * 0.10 - 105;
            } else if (income <= 9000) {
                tax = income * 0.20 - 555;
            } else if (income <= 35000) {
                tax = income * 0.25 - 1005;
            } else if (income <= 55000) {
                tax = income * 0.30 - 2755;
            } else if (income <= 80000) {
                tax = income * 0.35 - 5505;
            } else {
                tax = income * 0.45 - 13505;
            }
            System.out.println(employees.get(i).name + "应该缴纳的个人所得税是:" + tax);
        }
    }
}
class Employee{
    String name;
    int salary;
    public Employee(String name,int salary){
        this.name = name;
        this.salary = salary;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getSalary() {
        return salary;
    }
    public void setSalary(int salary) {
        this.salary = salary;
    }
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值