请教一个JAVA的计算程序

来源:百度知道 编辑:UC知道 时间:2024/09/22 16:44:45
请教一个程序计算一下公司的税额
首先输入员工的数目,如果不等於9999的话

1:当应付的工资小於1000时,税额是0
2:当工资在1000到3000之间时,税额应付工资的10%
3:当工资大於3000时,税额是25%

最后如果输入9999的时候则退出程序
谢谢

public static void main(String[] args){
try{
System.out.println("please input :");
BufferedReader reader = new BufferedReader(new InputStreamReader(
System.in));
String user = null;
int a=Integer.value(user).intval();
user =reader.readLine();
System.out.printls(a<1000?0:a>=1000&&a<=3000?a*0.1:a>3000&&a<>9999?a*0.25:0);
} catch (Exception ex){
}
}

是计算工资税额吧?输入的数应该定义为工资数才对啊?
import java.util.*;
public class Count{
public static void main(String args[]){
double pay = 0;
double tax = 0;
while(true){
System.out.println("请输入工资的数额:");
Scanner s = new Scanner(System.in);
try{
pay = s.nextDouble();
if(pay < 0){
System.out.println("格式错误,必须为大于零的数值!");
continue;
}
if(pay >= 1000 && pay <= 3000){
tax = pay*0.1;
}else if(pay > 3000 && pay !=