【C++】求征收税款

问题描述

        征收税款时,税率与收入有关,若规定收入 1000 元以下税率为 3%,1000~2000 元(包括 1000 元)税率为 4%,2000~3000(包括 2000 元)元税率5%,3000 元及以上税率为 6%。要求:输入收入,求出税款及税后收入。

        例如,输入 500,输出税款为 15,税后收入为 485;输入 3500,输出税款为 210,税后收入为 3290。


实现程序

代码如下(示例):

#include <iostream>
using namespace std;
int main()
{
	double t,i,ATI;	//定义税收为t,收入为i,税后收入为ATI 
	cout<<"Please enter income:";
	cin>>i;	//输入收入 
	
	if(i<1000)
	{
		t=i*0.03;		//计算税收 :税收=收入*税率 
		ATI=i-t;	 	//计算税后收入:税后收入=收入-税收 
		cout<<"Tax is:"<<t<<endl;
		cout<<"After tax income is:"<<ATI<<endl;
	}
			
	else if(1000<=i&&i<2000)
	{
		t=i*0.04;
		ATI=i-t;
		cout<<"Tax is:"<<t<<endl;
		cout<<"After tax income is:"<<ATI<<endl;
	}
		
	else if(2000<=i&&i<3000) 
	{
		t=i*0.05;
		ATI=i-t;
		cout<<"Tax is:"<<t<<endl;
		cout<<"After tax income is:"<<ATI<<endl;
	}
	
	else if(i>=3000) 
	{
		t=i*0.06;
		ATI=i-t;
		cout<<"Tax is:"<<t<<endl;
		cout<<"After tax income is:"<<ATI<<endl;
	}
		
	return 0;
		
 } 

实验结果

如下(示例):

Please enter income:500
Tax is:15

--------------------------------
Process exited after 6.435 seconds with return value 0
请按任意键继续. . .
Please enter income:3500
Tax is:210

--------------------------------
Process exited after 6.435 seconds with return value 0
请按任意键继续. . .

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值