题目:
题目描述:
2018年国家推出新的税收制度,起征点为每月5000元,不超过5000元的不需要纳税,超过5000的部分,则按下图的新版规则进行分级纳税
如月收入为15000元,假设无需缴纳其他用,按新版的规定,超出起征点,需要缴税的部分为10000元,需要缴纳的个人所得税为:
(3000-0)*3%+(10000-3000)*10%=790元
如月收入为50000元,假设无需缴纳其他费用,按新版的规定,超出起征点,需要缴税的部分为45000元,需要缴纳的个人所得税为:
(3000-0)*3%+(12000-3000)*10%+(25000-12000)
20%+(35000-25000)*25%+(45000-35000)*30%=9090元。
给出月收入,假设无需缴纳其他费用,请你计算所需要缴纳的个人所得貌,税费请四舍五入到整数。
输入描述:
每个输入数据包含多个测试点。
#include<iostream>
using namespace std;
int revenue(int n)
{
int m = n - 5000;
int tax;
double result;
if (m <= 0)
result= 0;
else if (m <= 3000)
result= m*0.03;
else if (m <= 12000)
result=3000 * 0.03 + (m - 3000)*0.1;
else if (m<=25000)
result=3000 * 0.03 + (12000 - 3000)*0.1 + (m - 12000)*0.2;
else if (m<=35000)
result=3000 * 0.03 + (12000 - 3000)*0.1 + (25000 - 12000)*0.2 + (m - 25000)*0.25;
else if (m <= 55000)
result=3000 * 0.03 + (12000 - 3000)*0.1 + (25000 - 12000)*0.2 + (35000 - 25000)*0.25
+ (m - 35000)*0.3;
else if (m <= 80000)
result=3000 * 0.03 + (12000 - 3000)*0.1 + (25000 - 12000)*0.2 + (35000 - 25000)*0.25
+ (55000 - 35000)*0.3 + (m - 55000)*0.35;
else
result=3000 * 0.03 + (12000 - 3000)*0.1 + (25000 - 12000)*0.2 + (35000 - 25000)*0.25
+ (55000 - 35000)*0.3 + (80000 - 55000)*0.35 + (m - 80000)*0.45;
double tmp = result - (int)result; //计算税收的小数部分
if (tmp < 0.5)
tax = (int)result; //小数部分小于0.5,只取整数部分
else
tax = (int)result + 1; //小数部分大于等于0.5,取整数部分+1
return tax;
}
int main()
{
int n; //有几个输入数字
cin >> n;
int m;
for (int i = 0; i < n;i++)
{
cin >> m;
cout << revenue(m)<<endl;
}
return 0;
}