taxCalculate.java
资源名称:project4.rar [点击查看]
上传用户:dscysp
上传日期:2021-04-07
资源大小:268k
文件大小:1k
源码类别:
家庭/个人应用
开发平台:
Java
- /**
- * 个人所得税计算
- * @author 蒋鹏
- *
- */
- public class taxCalculate {
- private taxScale taxScaleT;
- private int income;
- private int tax;
- public taxCalculate()
- {
- income = 0;
- tax = 0;
- taxScaleT = new taxScale();
- }
- public taxCalculate(int inc,taxScale ts)
- {
- income = inc;
- tax = 0;
- taxScaleT = ts;
- }
- /**
- * 计算个人所得税
- * @return 个人所得税
- */
- public double getTax()
- {
- int n = taxScaleT.getSize();
- int tempIncome = income - taxScaleT.getBase();
- if(tempIncome<=0)
- {
- tax = 0;
- }
- else
- {
- tax = 0;
- int i;
- int j;
- j = 0;
- for (i=0;i<n;i++)
- {
- if (taxScaleT.getScale(i,0)>tempIncome)
- break;
- }
- i--;
- for (j=0;j<i;j++)
- {
- tax += (taxScaleT.getScale(j+1,0)-taxScaleT.getScale(j,0))*taxScaleT.getScale(j,1)*0.01;
- }
- tax +=(tempIncome-taxScaleT.getScale(i,0))*taxScaleT.getScale(i,1)*0.01;
- }
- return tax;
- }
- }