美国联邦个人所得税是根据申报情况和应纳税所得额计算的。有四种申报情况:单身申报、已婚联合申报、已婚单独申报、户主申报。税率每年都不一样。下表即为假定税率计算方法,例如,某人单身申报,应纳税收入为$10,000,则计算方法为:$8,350的部分按10%计税,剩余的$1,650的部分按15%计税,因此其应缴税额为:$8,350×10%+$1,650×15%=$1,082.5。
输入格式:
请在一行中输入申报情况和应纳税收入金额,其中,输入申报情况用整型数表示,正确取值范围为03;应纳税金额为实型数,正确取值范围为0+∞。
输出格式:
(1)当输入数据合法时,输出应纳税金额,实型数; (2)当输入数据非法时,输出字符串“Wrong Format
输入样例1:
在这里给出一组输入。例如:
0 0
输出样例1:
在这里给出相应的输出。例如:
0.0
输入样例2:
在这里给出一组输入。例如:
0 100000
输出样例2:
在这里给出相应的输出。例如:
21720.0
输入样例3:
在这里给出一组输入。例如:
5 100000
输出样例3:
在这里给出相应的输出。例如:
Wrong Format
```java
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int type = input.nextInt();
float s=input.nextFloat();
float tax;
if(s>=0) {
if(type==0)
{
if(s<8350)
tax=(float) (s*0.1);
else if(s<=33950)
tax=(float) ((s-8350)*0.15+835);
else if(s<=82250)
tax=(float) ((s-33950)*0.25+4675);
else if(s<=171550)
tax=(float) ((s-82250)*0.28+16750);
else if(s<=372950)
tax=(float) ((s-171550)*0.33+41754);
else
tax=(float) (108216+(s-372950)*0.35);
System.out.println(tax);
}
else if(type==1)
{
if(s<=16700)
tax=(float) (0.1*s);
else if(s<=67900)
tax=(float) (1670+0.15*(s-16700));
else if(s<=137050)
tax=(float) (9350+0.25*(s-67900));
else if(s<=208850)
tax=(float) (0.28*(s-137050)+26637.5);
else if(s<=372950)
tax=(float) (0.33*(s-208850)+46741.5);
else
tax=(float) (0.35*(s-372950)+100894.5);
System.out.println(tax);
}
else if(type==2)
{
if(s<=8350)
tax=(float) (0.1*s);
else if(s<=33950)
tax=(float) (0.15*(s-8350)+835);
else if(s<=68525)
tax=(float) (0.25*(s-33950)+4675);
else if(s<=104425)
tax=(float) (0.28*(s-68525)+13318.75);
else if(s<=186475)
tax=(float) (0.33*(s-104425)+23370.75);
else
tax=(float) (0.35*(s-186475)+50447.25);
System.out.println(tax);
}
else if(type==3)
{
if(s<=11950)
tax=(float) (0.1*s);
else if(s<=45500)
tax=(float) (0.15*(s-11950)+1195);
else if(s<=117450)
tax=(float) (0.25*(s-45500)+6227.5);
else if(s<=190200)
tax=(float) (0.28*(s-117450)+24215);
else if(s<=372950)
tax=(float) (0.33*(s-190200)+44585);
else
tax=(float) (0.35*(s-372950)+104892.5);
System.out.println(tax);
}
else
{
System.out.println("Wrong Format");
}
}
else
System.out.println("Wrong Format");
}
}