📄 form1.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WinApp4_4个人所得税
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
decimal pay = (decimal)int.Parse(txtPay.Text);
decimal tax = 0;
decimal tax1 = (2100 - 1600) * 0.05m;
decimal tax2 = tax1 + (3600 - 2100) * 0.1m;
decimal tax3 = tax2 + (6600 - 3600) * 0.15m;
/*
decimal tax4 = tax3 + (21600 - 6600) * 0.2m;
decimal tax5 = tax4 + (41600 - 21600) * 0.25m;
decimal tax6 = tax5 + (61600 - 41600) * 0.30m;
decimal tax7 = tax6 + (81600 - 61600) * 0.35m;
decimal tax8 = tax7 + (101600 - 81600) * 0.4m;*/
if (pay > 20000)
{
MessageBox.Show("请输入20000以内的数!");
return;
}
if (pay <= 1600)
tax = 0m;
else if (pay <= 2100)
tax = (pay - 1600) * .05m;
else if (pay <= 3600)
tax = tax1 + (pay - 2100) * .1m;
else if (pay <= 6600)
tax = tax2 + (pay - 3600) * .15m;
else if (pay <= 21600)
tax = tax3 + (pay - 6600) * .2m;
/*
else if (pay <= 41600)
tax = tax4 + (pay - 21600) * .25m;
else if (pay <= 61600)
tax = tax5 + (pay - 41600) * .3m;
else if (pay <= 81600)
tax = tax6 + (pay - 61600) * .35m;
else if (pay <= 101600)
tax = tax7 + (pay - 81600) * .4m;
else
tax = tax8 + (pay - 101600) * .45m;*/
txtTax.Text = tax.ToString( );
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -