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; } }
编写个人所得税计算程序
于 2022-11-14 14:51:40 首次发布