个人所得税计算

个人所得税计算

packagecom.kaige123.ifelse;/**

* 凯哥

*/publicclassTestIfElse{publicstaticvoidmain(String[] args){java.util.Scanner input =newjava.util.Scanner(System.in);System.out.print("请输入您的工资:");intgz = input.nextInt();intss =0;gz -=3500;if(gz >=0) {if(gz <1500) {// 第一个等级 0.3 0ss = (int) (gz *0.03f);}else{if(gz <4500) {// 10 105ss = (int) (gz *0.1f-105);}else{if(gz <9000) {// 20 555ss = (int) (gz *0.2f-555);}else{if(gz <35000) {// 25 1005ss = (int) (gz *0.25f-1005);}else{if(gz <55000) {// 30 2755ss = (int) (gz *0.30f-2755);}else{if(gz <80000) {// 35 5505ss = (int) (gz *0.35f-5505);}else{ss = (int) (gz *0.45f-13505);}}}}}}System.out.println("您所有要交付的税务:"+ ss +"元");System.out.println("剩下的工资:"+ (gz+3500- ss) +"元");}else{System.out.println("您的工资还不在个人所得税之内,加油!");}}}

改进 if else

packagecom.kaige123.ifelse;/**

* 凯哥

*/publicclassTestIfElse{publicstaticvoidmain(String[] args){java.util.Scanner input =newjava.util.Scanner(System.in);System.out.print("请输入您的工资:");intgz = input.nextInt();intss =0;gz -=3500;if(gz >=0) {if(gz <1500) {// 第一个等级 0.3 0ss = (int) (gz *0.03f);}elseif(gz <4500) {// 10 105ss = (int) (gz *0.1f-105);}elseif(gz <9000) {// 20 555ss = (int) (gz *0.2f-555);}elseif(gz <35000) {// 25 1005ss = (int) (gz *0.25f-1005);}elseif(gz <55000) {// 30 2755ss = (int) (gz *0.30f-2755);}elseif(gz <80000) {// 35 5505ss = (int) (gz *0.35f-5505);}else{ss = (int) (gz *0.45f-13505);}System.out.println("您所有要交付的税务:"+ ss +"元");System.out.println("剩下的工资:"+ (gz +3500- ss) +"元");}else{System.out.println("您的工资还不在个人所得税之内,加油!");}}}

你可能感兴趣的:(个人所得税计算)