java计算税务代码 java所得税计算器

个人所得税应用程序设计 (JAVA编写)这个题目很有意思 。不用这么复杂 。大概10几句就做完了 。
以前我用C#做过的 。先把逻辑简化了 。几个IF THEN就搞定
怎样用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=0salary1500){
sefValue = https://www.04ip.com/post/(double)(salary-insureHome-deduct)*0.03 - 0;
}else if(salary=1500salary4500){
sefValue = https://www.04ip.com/post/(double)(salary-insureHome-deduct)*0.1 - 105;
}else if(salary=4500salary9000){
sefValue = https://www.04ip.com/post/(double)(salary-insureHome-deduct)*0.2 - 555;
}else if(salary=9000salary35000){
sefValue = https://www.04ip.com/post/(double)(salary-insureHome-deduct)*0.25 - 1005;
}else if(salary=35000salary55000){
sefValue = https://www.04ip.com/post/(double)(salary-insureHome-deduct)*0.30 - 2755;
}else if(salary=55000salary80000){
sefValue = https://www.04ip.com/post/(double)(salary-insureHome-deduct)*0.35 - 5505;
}else{
sefValue = https://www.04ip.com/post/(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编程计算工资个人所得税你一开始就 int KGongZ = GongZ-3500; 那我问你工资如果小于3500.不交税,最后反而要补贴了 。。。逻辑有错误
请高手帮忙 。1. 编写程序,输入每月收入,输出应纳的个人所得税 。例如输入50000,则输出11025 。被你的题目害了 , 500以下的税率没有,害我怎么也算不出11025总是11000 , 最后被我发现了 还有个5%的税率呢 。。哎
代码如下:import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Tax {
public static void main(String[] args) {
double money = 0.0d, tax = 0.0d, cha = 0.0d;
int n = 2000;
System.out.println("请输入您的工资水平(数字):");
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
try {
money = Double.parseDouble(in.readLine());
cha = money - n;
if (cha500cha = 2000) {
tax = 25(cha - 500) * 0.10;
} else if (cha2000cha = 5000) {
tax = 25150(cha - 2000) * 0.15;
} else if (cha5000cha = 20000) {
tax = 25150450(cha - 5000) * 0.20;
} else if (cha20000cha = 40000) {
tax = 251504503000(cha - 20000) * 0.25;
} else if (cha40000cha = 60000) {
tax = 2515045030005000(cha - 40000) * 0.3;
} else if (cha60000cha = 80000) {
tax = 25150450300050006000(cha - 60000)
* 0.35;
} else if (cha80000cha = 100000) {
tax = 251504503000500060007000
(cha - 80000) * 0.4;
} else if (cha100000) {
tax = 2515045030005000600070008000
(cha - 100000) * 0.45;
}else{
tax = money*0.05;
}
} catch (NumberFormatException e) {
System.out.println("您输入的工资数据类型不是纯数字,不能计算!");
} catch (IOException e) {
System.out.println("输入出现异常 , 请重新运行程序 。");
}
System.out.println("税后您应得:"(money - tax));
System.out.println("应缴税为:"tax);
}
}
java 编程 计算工人工资,JAVA计算工人工资,参考例子如下:
import java.util.Scanner;
public class Demo00 {
//定义一个三维数组,用于记录每个部门、分支、绩效工资
private static final float[][][] SALARY_OF_PER_HOUR = {
{{10.75f,12.50f,14.50f},{11.75f,14.50f,17.50f}},
{{13.00f,16.00f,18.50f},{15.00f,18.50f,22.00f}},
{{16.75f,18.50f,20.50f},{19.25f,25.00f,30.00f}}
};
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
//输入姓名
System.out.println("请输入姓名:");
String name = sc.nextLine();
//输入部门并验证
System.out.println("请输入部门: A,B,C");
char dept = sc.nextLine().charAt(0);
if(dept'A'||dept'C')
{
System.out.println("输入有误,系统将退出");
System.exit(0);
}
//输入分支机构并验证
System.out.println("请输入分支机构: 1,2");
char div = sc.nextLine().charAt(0);
if(div'1'||div'2')
{
System.out.println("输入有误,系统将退出");
System.exit(0);
}
//输入薪绩表并验证
System.out.println("请输入薪绩表: a,b,c");
char sal = sc.nextLine().charAt(0);
if(sal'a'||sal'c')
{
System.out.println("输入有误,系统将退出");
System.exit(0);
}
//输入小时数
System.out.println("请输入本周工作时间(整小时数):");
int hours = sc.nextInt();
float salary = 0;
//每个小时的薪水
float salaryPerHour = SALARY_OF_PER_HOUR[dept-'A'][div-'1'][sal-'a'];
//分别计算40小时内和超过40小时的薪水
if(hours=40)
{
salary= salaryPerHour*hours;
}
else
{
salary= salaryPerHour*hours (hours-40)*1.5*salaryPerHour;
}
//输出结果
System.out.println("姓名:\t" name "\n部门:\t" dept "\n分支机构:\t" div
"\n薪绩表:\t" sal "\n工作时间:\t" hours "\n薪水:\t" salary);
}
}
//Best wishes!
使用JavaBean设计个人所得税计算器,要求写出TaxInput.html、TaxBean.java、TaxResult.jsp,税率表如下:首先写JAVABEAN文件:WageTax.java/**nbsp;*nbsp;*nbsp;@authornbsp;剑江帝国nbsp;*nbsp;@usagenbsp;计算个人所得税nbsp;*nbsp;@datenbsp;2008-10-8nbsp;*/publicnbsp;classnbsp;WageTaxnbsp;implementsnbsp;java.io.Serializable{nbsp;nbsp;nbsp;nbsp;privatenbsp;doublenbsp;wage;//定义工资nbsp;nbsp;nbsp;nbsp;privatenbsp;Stringnbsp;output=““;//定义输入nbsp;nbsp;nbsp;nbsp;/**nbsp;nbsp;nbsp;nbsp;nbsp;*nbsp;输入一个字符串,代表工资,如果输入出错会将错误写至outputnbsp;nbsp;nbsp;nbsp;nbsp;*/nbsp;nbsp;nbsp;nbsp;publicnbsp;voidnbsp;setWage(Stringnbsp;wageInput){nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;try{nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;this.wage=Double.parseDouble(wageInput);nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;}nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;catch(Exceptionnbsp;ex){nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;output=“输入有误“;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;this.wage=-1;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;}nbsp;nbsp;nbsp;nbsp;}nbsp;nbsp;nbsp;nbsp;/**nbsp;nbsp;nbsp;nbsp;nbsp;*nbsp;计算税额,算法简单说一下 。nbsp;nbsp;nbsp;nbsp;nbsp;*/nbsp;nbsp;nbsp;nbsp;publicnbsp;doublenbsp;countTax(){nbsp;nbsp;nbsp;nbsp;nbsp;ifnbsp;(wage-2000amp;gt;0){nbsp;nbsp;nbsp;nbsp;//第一步 , 将个人的工资减去2000后按交税等级分成若干个收入块nbsp;nbsp;nbsp;nbsp;//第二步,按对应税率统计每个块应该交税额并相加,之后返回nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;//STEP1nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;wage=wage-2000;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;doublenbsp;rate[]={0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45};nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;intnbsp;bound[]={0,500,2000,5000,20000,40000,60000,80000,100000};nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;doublenbsp;chunk[]={0,0,0,0,0,0,0,0,0};nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;for(intnbsp;i=1;iamp;lt;9;i){nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;ifnbsp;(wage-bound[i] bound[i-1]amp;gt;0)nbsp;{nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;wage=wage-bound[i] bound[i-1];nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;chunk[i-1]=bound[i]-bound[i-1];nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;}nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;else{nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;chunk[i-1]=wage;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;wage=-1;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;break;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;}nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;}nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;ifnbsp;(wageamp;gt;0)nbsp;chunk[8]=wage;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;doublenbsp;tax=0;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;for(intnbsp;i=0;iamp;lt;9;i){nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;tax=tax chunk[i]*rate[i];nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;}nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;returnnbsp;tax;nbsp;nbsp;nbsp;nbsp;nbsp;}nbsp;nbsp;nbsp;nbsp;nbsp;elsenbsp;returnnbsp;0;nbsp;nbsp;nbsp;nbsp;}nbsp;nbsp;nbsp;nbsp;/**nbsp;nbsp;nbsp;nbsp;nbsp;*nbsp;获得税款数nbsp;nbsp;nbsp;nbsp;nbsp;*/nbsp;nbsp;nbsp;nbsp;publicnbsp;Stringnbsp;getTax(){nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;ifnbsp;(output.equals(““)){nbsp;nbsp;nbsp;nbsp;returnnbsp;Double.toString(countTax());}nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;elsenbsp;returnnbsp;output;nbsp;nbsp;nbsp;nbsp;}}///////////////////////////////////////////////////////然后在输出页面中使用设定wage属性为工资,获得tax属性得到税
【java计算税务代码 java所得税计算器】关于java计算税务代码和java所得税计算器的介绍到此就结束了 , 不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站 。

    推荐阅读