一、题目:计算个人所得税
输入一个人的工资,输出所得税;
1)如果输入为负数或超过100000(10万),给出重新输入的提示;
2)如果工资小于3500,不用缴税;
3)如果工资大于等于3500,并且小于 8000;那么先减去 3500 ,剩下的再缴 10% 的所得税;
4)如果工资大于等于8000,并且小于 12000;那么先减去 3500,剩下的再缴 20% 的所得税;
5)如果大于等于12000,需要缴 30% 的所得税;
二、编程实现
// 爱码岛编程
#include <iostream>
using namespace std;
int main(){
cout << "请输入您的工资:"<< endl;
int gongZi;
cin >> gongZi;
int shengYuGongZi;//剩余工资
int shui;//交税
if(gongZi < 0 || gongZi > 100000){
cout << "输入错误,请重新输入" <<endl;
}else if(gongZi >=0 && gongZi < 3500){
cout << "不用交税" <<endl;
}else if(gongZi >= 3500 && gongZi < 8000) {
shengYuGongZi = gongZi - 3500;
shui = shengYuGongZi * 10 / 100;
cout << "交税:" << shui << endl;
}else if(gongZi >= 8000 && gongZi < 12000){
shengYuGongZi = gongZi - 3500;
shui = shengYuGongZi * 20 / 100;
cout << "交税:" << shui <<endl;
}else if(gongZi >= 12000 && gongZi <= 100000){
shui = gongZi * 30 / 100;
cout << "交税:" << shui <<endl;
}
return 0;
}