问题:(复制自老师博文)
第10周实践:请完成下面的项目,并发博客作为解题报告
【项目1】
编写选择结构程序,输入个人月收入总额,计算出他本月应缴税款和税后收入(计算办法见附:关于个人所得税的有关背景知识)。
可以在下面程序的基本框架基础上完成,如需其他变量自行增加
/*
烟台大学计算机与控制工程学院
冯琬淇
问题:项目1 求个人所得税
备注:具体分析与多种解题方式详见老师博文
*/
#include <stdio.h>
#include <stdlib.h>
int main()
{
double dSalary,dTax=0,dNetIncome=0;
double dValue;
double dRate,doffset;
printf("请输入您本月的收入总额(元):");
scanf("%lf",&dSalary);
dValue=dSalary-3500;
if(dValue<=0.0)
dTax=0.0;
else
{
if(dValue<=1500)
dRate=0.03,doffset=0.0;
else if(dValue<=4500)
dRate=0.1,doffset=105.0;
else if(dValue<=9000)
dRate=0.2,doffset=555.0;
else if(dValue<=35000)
dRate=0.25,doffset=1005.0;
else if(dValue<=55000)
dRate=0.3,doffset=2755.0;
else if(dValue<=80000)
dRate=0.35,doffset=5505.0;
else
dRate=0.45,doffset=13505.0;
dTax=dValue*dRate-doffset;
}
dNetIncome=dSalary-dTax;
printf("您本月应个人所得税%.21f元,税后收入是%.21f元。\n",dTax,dNetIncome);
printf("依法纳税,共享繁荣。谢谢使用!\n");
return 0;
}
具体链接:
http://blog.youkuaiyun.com/sxhelijian/article/details/53006363