符合中小企业对网站设计、功能常规化式的企业展示型网站建设
本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...
商城网站建设因基本功能的需求不同费用上面也有很大的差别...
手机微信网站开发、微信官网、微信商城网站...
public class Employee {
专注于为中小企业提供成都做网站、成都网站建设服务,电脑端+手机端+微信端的三站合一,更高效的管理,为中小企业西湖免费做网站提供优质的服务。我们立足成都,凝聚了一批互联网行业人才,有力地推动了近1000家企业的稳健成长,帮助中小企业通过网站建设实现规模扩充和转变。
String name;
double salary;
double subsidy;
private Scanner sc;
public void setA() {
sc = new Scanner(System.in);
System.out.println("请输入员工的姓名:");
name = sc.next();
try {
name = new String(name.getBytes("GBK"));
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// 可是我怎么都运行不出来,求好心人帮帮忙看看!!
System.out.println("请输入员工工资:");
salary = sc.nextDouble();
System.out.println("请输入员工的加班补贴:");
subsidy = sc.nextDouble();
}
public void getshuishou() {
double before = 0;
double after = 0;
double suodeshui = 0;
before = salary + subsidy;
if (before 冲明= 2000 before 2500) {
suodeshui = ((before - 2000) * 0.05);
} else if (before = 2500 before 4000) {
suodeshui = ((before - 2000) * 0.1);
} else if (before = 4000 before 7000) {
suodeshui = ((before - 2000) * 0.15);
} else if (before = 7000 before 22000) {
suodeshui = ((before - 2000) * 0.2);
} else if (before = 22000) {
suodeshui = ((before - 2000) * 0.3);
} else {
suodeshui = 0;
}
after = before - suodeshui; //把这句放到这里。
System.out.print("员工" + name + "的税前收入为:" + before + "元" + "," + "税后收入为"
+ after + "元"裂陪 + "," + "您缴纳的个人所得税为:" + suodeshui + "元");
}
public static void main(String[] args) {
Employee emp = new Employee();
emp.setA();
emp.getshuishou();
}
}
我给你修改了一下。。你看看。
我给你把这个代码 改了一下,你看,你能不能看出它的好处。。
public class Employee {
private String name;
private double salary;
private double subsidy;
/**
* 无参构造
*/
public Employee() {
// TODO Auto-generated constructor stub
}
/**
* 有参构造
* @param name
* @param salary
* @param subsidy
*/
public Employee(String name,double salary,double subsidy) {
this.name = name;
this.salary = salary;
this.subsidy = subsidy;
}
/**
* 计算税收
* @author 朱泽江
* @date 2014-4-11 下午05:40:37
*/
public void getshuishou() {
double before = 0;
double after = 0;
double suodeshui = 0;
before = salary + subsidy;
if (before = 2000 before 2500) {
suodeshui = ((before - 2000) * 0.05);
} else if (before = 2500 before 4000) {
suodeshui = ((before - 2000) 肆判蠢* 0.1);
} else if (before = 4000 before 7000) {
suodeshui = ((before - 2000) * 0.15);
} else if (before = 7000 before 22000) {
suodeshui = ((before - 2000) * 0.2);
} else if (before = 22000) {
suodeshui = ((before - 2000) * 0.3);
} else {
suodeshui = 0;
}
after = before - suodeshui;
System.out.print("员工" + name + "的税前收入为:" + before + "元" + "," + "税后收入为"
+ after + "元" + "," + "您缴纳的个人所得税为:" + suodeshui + "元");
}
/**
* 测试的方法
* @author 朱泽江
* @date 2014-4-11 下午05:41:16
* @param args
* 这样写的好处是把业务类,与测试类,分开
*/
public static void main(String[] args) {
Scanner sc;
sc = new Scanner(System.in);
System.out.println("请输入员工的姓名:");
String name = sc.next();
try {
name = new String(name.getBytes("GBK"));
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// 可是我怎么都运行不出来,求好心人帮帮忙看看!!
System.out.println("请输入员工工资:");
double salary = sc.nextDouble();
System.out.println("请输入员工的加班补贴:");
double subsidy = sc.nextDouble();
Employee emp = new Employee(name,salary,subsidy);
emp.getshuishou();
}
}
这闹喊羡个题液拍目很有意思。不用这么复杂。大概10几句就做完了。
以前我用C#做过的。先把逻辑简化渗销了。几个IF THEN就搞定
被你的题目害了,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 (cha 500 cha = 2000) {
tax = 25 + (cha - 500) * 0.10;
} else if (cha 2000 cha = 5000) {
tax = 25 + 150 + (cha - 2000) * 0.15;
} else if (cha 5000 cha = 20000) {
tax = 25 + 150 + 450 + (cha - 5000) * 0.20;
} else if (cha 20000 cha 闭并= 40000) {
tax = 25 + 150 + 450 + 3000 + (cha - 20000) * 0.25;
} else if (cha 40000 cha = 60000) {
tax = 25 + 150 + 450 + 3000 + 5000 + (cha - 40000) * 0.3;
} else if (cha 60000 cha = 80000) {
tax = 25 + 150 + 450 + 3000 + 5000 + 6000 + (cha - 60000)
* 0.35;
} else if (cha 80000 cha = 100000) {
tax = 25 + 150 + 450 + 3000 + 5000 + 6000 + 7000
+ (cha - 80000) * 0.4;
} else if (cha 100000) {
tax = 25 + 150 + 450 + 3000 + 5000 + 6000 + 7000 + 8000
+ (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);
}
}