扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
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();
}
}
运行结果:
package COM.T;
import java.util.Scanner;
class Print1{
public void write1(){
System.out.println("0-单身纳税人,1-已婚共同纳税人或证实的鳏寡,2-已婚单独纳税人, 3-家庭户主纳税人");}
public void write2(){
System.out.print("Enter the taxable income:");}
public void write3(){
System.out.print("Enter the filling static:");}
}
public class Test {
public static void main(String[] args) {
double tax=0;
double[] rates = {0.10,0.15,0.25,0.28,0.33,0.35};
int[][] brackets = {
{8350,33950,82250,171550,372950},
{16700,67900,137050,208850,372950},
{8350,33950,68525,104425,186475},
{11950,45500,117450,190200,372950}
};
代码要发完整是很麻烦的 想知道可以找我
勉费java学习裙开头的的第一部分是:四二六,位于中间的第二部分是:三九六,处于最后一部分的是二八四:二八四
这个题目很有意思。不用这么复杂。大概10几句就做完了。
以前我用C#做过的。先把逻辑简化了。几个IF THEN就搞定
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 + " 元");
}
public float ComputeTax(float income) //income为工资
{
float f_income=income-800; //起征基数为800,同时也可以参数化处理
float[] tax_line={0f,500f,2000f,5000f,20000f,40000f,60000f,80000f,100000f};//计算个人所得税的档次(假设员工为中国国籍,因为国籍不同起征点数不同,税率不同。)
float[] tax_rate={0f,0.05f,0.10f,0.15f,0.20f,0.25f,0.30f,0.35f,0.40f}; //各档次税率
float[] tax_sub={0.f,25f,125f,375f,1375f,3375f,6375f,10375f,15375f}; //采用了简化算法
int i_tax_level=0; //为了计算简便,把工资进行分档
while(f_incometax_line[i_tax_level]i_tax_leveltax_line.length)
{
i_tax_level++;
};
if(i_tax_level0)
{
float f_tax=tax_sub[i_tax_level-1]+(f_income-tax_line[i_tax_level-1])*tax_rate[i_tax_level]; //算税的公式
return f_tax;
}
else
{
return 0f;
}
}
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流