首页 > 代码库 > 个人所得税计算

个人所得税计算

个人所得税计算

package com.kaige123.ifelse; /*** 凯哥*/ public class TestIfElse { public static void main(String[] args) {		java.util.Scanner input = new java.util.Scanner(System.in);		System.out.print("请输入您的工资:"); int gz = input.nextInt(); int ss = 0;		gz -= 3500; if (gz >= 0) { if (gz < 1500) {// 第一个等级 0.3 0 ss = (int) (gz * 0.03f);			} else { if (gz < 4500) {// 10 105 ss = (int) (gz * 0.1f - 105);				} else { if (gz < 9000) {// 20 555 ss = (int) (gz * 0.2f - 555);					} else { if (gz < 35000) {// 25 1005 ss = (int) (gz * 0.25f - 1005);						} else { if (gz < 55000) {// 30 2755 ss = (int) (gz * 0.30f - 2755);							} else { if (gz < 80000) {// 35 5505 ss = (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

package com.kaige123.ifelse; /*** 凯哥*/ public class TestIfElse { public static void main(String[] args) {		java.util.Scanner input = new java.util.Scanner(System.in);		System.out.print("请输入您的工资:"); int gz = input.nextInt(); int ss = 0;		gz -= 3500; if (gz >= 0) { if (gz < 1500) {// 第一个等级 0.3 0 ss = (int) (gz * 0.03f);			} else if (gz < 4500) {// 10 105 ss = (int) (gz * 0.1f - 105);			} else if (gz < 9000) {// 20 555 ss = (int) (gz * 0.2f - 555);			} else if (gz < 35000) {// 25 1005 ss = (int) (gz * 0.25f - 1005);			} else if (gz < 55000) {// 30 2755 ss = (int) (gz * 0.30f - 2755);			} else if (gz < 80000) {// 35 5505 ss = (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("您的工资还不在个人所得税之内,加油!");		}	}}

个人所得税计算