using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
double income = double.Parse(System.Console.ReadLine());
double tax = GetTax(income);
System.Console.WriteLine("你的税前收入为{0},个税为{1},税后收入为 {2}", income, tax, income - tax);
}
public static double GetTax (double income)
{
double tax = 0;
if (income <= 500)
{
tax = income * 0.05;
}
if (income > 500 && income <= 2000)
{
tax = income * 0.1 - 25; }
if (income > 2000 && income <= 5000)
{
tax = income * 0.15 - 125;
}
if (income > 5000 && income <= 20000)
{
tax = income * 0.2 - 375;
}
return tax;
} }
}
GetTax 什么意思。
using System.Collections.Generic;
using System.Linq;
using System.Text;namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
double income = double.Parse(System.Console.ReadLine());
double tax = GetTax(income);
System.Console.WriteLine("你的税前收入为{0},个税为{1},税后收入为 {2}", income, tax, income - tax);
}
public static double GetTax (double income)
{
double tax = 0;
if (income <= 500)
{
tax = income * 0.05;
}
if (income > 500 && income <= 2000)
{
tax = income * 0.1 - 25; }
if (income > 2000 && income <= 5000)
{
tax = income * 0.15 - 125;
}
if (income > 5000 && income <= 20000)
{
tax = income * 0.2 - 375;
}
return tax;
} }
}
GetTax 什么意思。
解决方案 »
- 怎么把datagridview里的数据插入到数据库里
- WPF 的问题
- radioButton1.Checked==true 出错?
- 请问,在winform中,用dataGridView,我选中一行,如何得到选中的行的第一个列的值?
- 我写一段求迷宫是否可走通的代码,效果不行,求助?迷宫用0,1数组Map[20,20],1标示墙体,0标示路
- 有关优化大师右侧列表的控件
- 怎么实现这种效果???表中再套一个表
- button控件 Enable属性 在起线程下出现的奇怪问题。请指教!
- 如何根据字符串取某个类的对应的属性值?
- 〓〓〓如何在repeater_ItemCommand()中获得当前行的字段值?〓〓〓
- 动态窗体问题
- 新手求教 在panel中摆放的按钮位置
根据这句话,就知道GetTax是自己写的一个类的类名,这个类返回一个double类型的值,需要输入一个double类型的值。
具体含义正在看代码中……
因为是静态函数,可以使用GetTax直接调用,实际是Program.GetTax调用。
GetTax定义了一种计算税收的方法:
500以内,税收为income*0.05
500~2000,税收为income*0.1-25
……
往下就不用说了……