1、
2019年1月1日起,国家推出新的个人所得税政策,起征点上调值5000元。
也就是说税前工资扣除三险一金(三险一金数额假设是税前工资的10%)后如果不足5000元,则不交税。
如果大于5000元,那么大于5000元的部分按梯度交税,具体梯度比例如下:
0 ~ 3000元的部分,交税3% 90
3000 ~ 12000元的部分,交税10% 900
12000 ~ 25000的部分 , 交税20% 2600
25000 ~ 35000的部分,交税25% 2500
35000 ~ 55000的部分,交税30% 6000
55000 ~ 80000的部分,交税35% 8750
超过80000的部分,交税45%
比如:小蓝入职一家企业后,税前工资是18000,则他每月该交个税的部分是18000-1800-5000=11200元,
个税缴纳数额是3000×3%+8200×10%=910元。税后工资15290元。
请完成一个个税计算程序,在用户输入税前工资后,计算出他对应的纳税数额,以及税后工资为多少?
package com.ithema_01;
/*
2019年1月1日起,国家推出新的个人所得税政策,起征点上调值5000元。
也就是说税前工资扣除三险一金(三险一金数额假设是税前工资的10%)后如果不足5000元,则不交税。
如果大于5000元,那么大于5000元的部分按梯度交税,具体梯度比例如下:
0 ~ 3000元的部分,交税3% 90
3000 ~ 12000元的部分,交税10% 900
12000 ~ 25000的部分 , 交税20% 2600
25000 ~ 35000的部分,交税25% 2500
35000 ~ 55000的部分,交税30% 6000
55000 ~ 80000的部分,交税35% 8750
超过80000的部分,交税45%
比如:小蓝入职一家企业后,税前工资是18000,则他每月该交个税的部分是18000-1800-5000=11200元,
个税缴纳数额是3000×3%+8200×10%=910元。税后工资15290元。
请完成一个个税计算程序,在用户输入税前工资后,计算出他对应的纳税数额,以及税后工资为多少?
*/
/*
1,获取工资数据
2,个税部分计算调用
3,个税缴纳数额计算调用
4,输出结果
*/
import java.util.Scanner;
public class StudentDemo {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
System.out.println("请输入税前工资:");
int GrossPay= sc.nextInt();
if ((GrossPay-GrossPay*0.1)>5000){
// double result= TotalPrincipalAndInterest(GrossPay);
double result= TotalPrincipalAndInterest(GrossPay);
System.out.println(result);
}else {
double result= TotalPrincipalAndInterest2(GrossPay);
System.out.println("纳税金额:"+0+"元");
System.out.println("税后工资:"+result+"元");
}
}
public static int TotalPrincipalAndInterest(int GrossPay){
double PersonalTax= GrossPay-GrossPay*0.1-5000;
if (PersonalTax<3000){
double PremiumReceived=PersonalTax*0.3;
System.out.println("纳税金额:"+PremiumReceived+"元");
double AfterTaxSalary=GrossPay-GrossPay*0.1-PremiumReceived;
System.out.println("税后工资:"+AfterTaxSalary+"元");
}else if (PersonalTax<12000&&PersonalTax>3000) {
double PremiumReceived=(PersonalTax-3000)*0.1+90;
System.out.println("纳税金额:"+PremiumReceived+"元");
double AfterTaxSalary=GrossPay-GrossPay*0.1-PremiumReceived;
System.out.println("税后工资:"+AfterTaxSalary+"元");
}else if (PersonalTax<25000&&PersonalTax>12000) {
double PremiumReceived=(PersonalTax-12000)*0.2+900+90;
System.out.println("纳税金额:"+PremiumReceived+"元");
double AfterTaxSalary=GrossPay-GrossPay*0.1-PremiumReceived;
System.out.println("税后工资:"+AfterTaxSalary+"元");
}else if (PersonalTax<35000&&PersonalTax>25000) {
double PremiumReceived=(PersonalTax-25000)*0.25+2600+900+90;
System.out.println("纳税金额:"+PremiumReceived+"元");
double AfterTaxSalary=GrossPay-GrossPay*0.1-PremiumReceived;
System.out.println("税后工资:"+AfterTaxSalary+"元");
}else if (PersonalTax<55000&&PersonalTax>35000) {
double PremiumReceived=(PersonalTax-35000)*0.35+2500+2600+900+90;
System.out.println("纳税金额:"+PremiumReceived+"元");
double AfterTaxSalary=GrossPay-GrossPay*0.1-PremiumReceived;
System.out.println("税后工资:"+AfterTaxSalary+"元");
}else if (PersonalTax<80000&&PersonalTax>55000) {
double PremiumReceived=(PersonalTax-35000)*0.35+6000+2500+2600+900+90;
System.out.println("纳税金额:"+PremiumReceived+"元");
double AfterTaxSalary=GrossPay-GrossPay*0.1-PremiumReceived;
System.out.println("税后工资:"+AfterTaxSalary+"元");
}else if (PersonalTax>80000) {
double PremiumReceived=(PersonalTax-80000)*0.45+8750+6000+2500+2600+900+90;
System.out.println("纳税金额:"+PremiumReceived+"元");
double AfterTaxSalary=GrossPay-GrossPay*0.1-PremiumReceived;
System.out.println("税后工资:"+AfterTaxSalary+"元");
}
return 0;
}
public static int TotalPrincipalAndInterest2(int GrossPay){
return (int) (GrossPay-GrossPay*0.1);
}
}
2、
手机选号:根据用户输入的手机号来确认用户实际支付的价格
如果尾数为8,需支付办卡费50元
如果尾数为4,需支付办卡费用0元
如果是其他尾号,需支付办卡费用20元
package com.ithema_01;
/*
手机选号:根据用户输入的手机号来确认用户实际支付的价格
如果尾数为8,需支付办卡费50元
如果尾数为4,需支付办卡费用0元
如果是其他尾号,需支付办卡费用20元
*/
import java.util.Scanner;
public class StudentDemo {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("请输入你的手机号:");
int cellPhoneNumber = sc.nextInt();
if (cellPhoneNumber%10==8){
System.out.println("需支付办卡费50元");
} else if (cellPhoneNumber%10==4) {
System.out.println("需支付办卡费0元");
}else {
System.out.println("需支付办卡费20元");
}
}
}
3、
接收用户输入的邮箱名,获取邮箱的名字
比如:cxy@163.com,输出cxy
package com.ithema_01;
/*
接收用户输入的邮箱名,获取邮箱的名字
比如:cxy@163.com,输出cxy
*/
import java.util.Scanner;
public class StudentText {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
System.out.println("请输入邮箱名:");
String MailboxName= sc.next();
String str= MailboxName;
System.out.println(str.substring(0,3));
}
}